Bug 1187107 - Add "Learn more" link about Mixed Content to Site Identity doorhanger. r=mhaigh
authorChenxia Liu <liuche@mozilla.com>
Thu, 30 Jul 2015 18:44:06 -0700
changeset 255646 cf8a0521b6c6b44441c961479b108a2411bbb710
parent 255645 18785164404c20917017dc911a5e06df59939cad
child 255647 b7930a87cabd2edaa30aa736059f15dc969c4b48
push id14356
push usercliu@mozilla.com
push dateFri, 31 Jul 2015 21:03:16 +0000
treeherderfx-team@b7930a87cabd [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmhaigh
bugs1187107
milestone42.0a1
Bug 1187107 - Add "Learn more" link about Mixed Content to Site Identity doorhanger. r=mhaigh
mobile/android/base/resources/layout/site_identity.xml
mobile/android/base/toolbar/SiteIdentityPopup.java
--- a/mobile/android/base/resources/layout/site_identity.xml
+++ b/mobile/android/base/resources/layout/site_identity.xml
@@ -66,16 +66,26 @@
 
                 <TextView android:id="@+id/verifier"
                           android:layout_width="match_parent"
                           android:layout_height="wrap_content"
                           android:layout_marginTop="@dimen/doorhanger_section_padding_medium"
                           android:textAppearance="@style/TextAppearance.DoorHanger.Medium.Light"/>
 
             </LinearLayout>
+
+            <TextView android:id="@+id/site_identity_link"
+                      android:layout_width="match_parent"
+                      android:layout_height="wrap_content"
+                      android:textAppearance="@style/TextAppearance.DoorHanger.Medium"
+                      android:textColor="@color/link_blue"
+                      android:layout_marginTop="@dimen/doorhanger_section_padding_large"
+                      android:text="@string/learn_more"
+                      android:visibility="gone"/>
+
             <TextView android:id="@+id/site_settings_link"
                       android:layout_width="match_parent"
                       android:layout_height="wrap_content"
                       android:textAppearance="@style/TextAppearance.DoorHanger.Medium"
                       android:textColor="@color/link_blue"
                       android:layout_marginTop="@dimen/doorhanger_section_padding_large"
                       android:text="@string/contextmenu_site_settings"
                       android:visibility="gone"/>
--- a/mobile/android/base/toolbar/SiteIdentityPopup.java
+++ b/mobile/android/base/toolbar/SiteIdentityPopup.java
@@ -45,20 +45,22 @@ import org.mozilla.gecko.widget.Doorhang
 import org.mozilla.gecko.widget.SiteLogins;
 
 /**
  * SiteIdentityPopup is a singleton class that displays site identity data in
  * an arrow panel popup hanging from the lock icon in the browser toolbar.
  */
 public class SiteIdentityPopup extends AnchoredPopup implements GeckoEventListener {
 
-    public static enum ButtonType { DISABLE, ENABLE, KEEP_BLOCKING, CANCEL, COPY };
+    public static enum ButtonType { DISABLE, ENABLE, KEEP_BLOCKING, CANCEL, COPY }
 
     private static final String LOGTAG = "GeckoSiteIdentityPopup";
 
+    private static final String MIXED_CONTENT_SUPPORT_URL =
+        "https://support.mozilla.org/kb/how-does-insecure-content-affect-safety-android";
     private static final String TRACKING_CONTENT_SUPPORT_URL =
         "https://support.mozilla.org/kb/firefox-android-tracking-protection";
 
     // Placeholder string.
     private final static String FORMAT_S = "%s";
 
     private final Resources mResources;
     private SiteIdentity mSiteIdentity;
@@ -69,16 +71,17 @@ public class SiteIdentityPopup extends A
 
     private ImageView mIcon;
     private TextView mTitle;
     private TextView mSecurityState;
     private TextView mMixedContentActivity;
     private TextView mOwner;
     private TextView mOwnerSupplemental;
     private TextView mVerifier;
+    private TextView mLink;
     private TextView mSiteSettingsLink;
 
     private View mDivider;
 
     private DoorHanger mTrackingContentNotification;
     private DoorHanger mSelectLoginDoorhanger;
 
     private final OnButtonClickListener mContentButtonClickListener;
@@ -113,16 +116,24 @@ public class SiteIdentityPopup extends A
         mSecurityState = (TextView) mIdentity.findViewById(R.id.site_identity_state);
         mMixedContentActivity = (TextView) mIdentity.findViewById(R.id.mixed_content_activity);
 
         mOwner = (TextView) mIdentityKnownContainer.findViewById(R.id.owner);
         mOwnerSupplemental = (TextView) mIdentityKnownContainer.findViewById(R.id.owner_supplemental);
         mVerifier = (TextView) mIdentityKnownContainer.findViewById(R.id.verifier);
         mDivider = mIdentity.findViewById(R.id.divider_doorhanger);
 
+        mLink = (TextView) mIdentity.findViewById(R.id.site_identity_link);
+        mLink.setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View view) {
+                Tabs.getInstance().loadUrlInTab(MIXED_CONTENT_SUPPORT_URL);
+            }
+        });
+
         mSiteSettingsLink = (TextView) mIdentity.findViewById(R.id.site_settings_link);
     }
 
     private void updateIdentity(final SiteIdentity siteIdentity) {
         if (!mInflated) {
             init();
         }
 
@@ -294,27 +305,31 @@ public class SiteIdentityPopup extends A
             stateIcon.setBounds(0, 0, stateIcon.getIntrinsicWidth()/2, stateIcon.getIntrinsicHeight()/2);
             mSecurityState.setCompoundDrawables(stateIcon, null, null, null);
             mSecurityState.setCompoundDrawablePadding((int) mResources.getDimension(R.dimen.doorhanger_drawable_padding));
             mSecurityState.setText(R.string.identity_connection_secure);
 
             if (siteIdentity.getMixedMode() == MixedMode.MIXED_CONTENT_BLOCKED) {
                 mMixedContentActivity.setVisibility(View.VISIBLE);
                 mMixedContentActivity.setText(R.string.mixed_content_blocked_all);
+                mLink.setVisibility(View.VISIBLE);
             } else {
                 mMixedContentActivity.setVisibility(View.GONE);
+                mLink.setVisibility(View.GONE);
             }
         } else {
             if (siteIdentity.getMixedMode() == MixedMode.MIXED_CONTENT_LOADED) {
                 mIcon.setImageResource(R.drawable.lock_disabled);
                 mMixedContentActivity.setVisibility(View.VISIBLE);
                 mMixedContentActivity.setText(R.string.mixed_content_protection_disabled);
+                mLink.setVisibility(View.VISIBLE);
             } else {
                 mIcon.setImageResource(R.drawable.globe_light);
                 mMixedContentActivity.setVisibility(View.GONE);
+                mLink.setVisibility(View.GONE);
             }
 
             mSecurityState.setText(R.string.identity_connection_insecure);
             mSecurityState.setTextColor(mResources.getColor(R.color.placeholder_active_grey));
             mSecurityState.setCompoundDrawablesWithIntrinsicBounds(0, 0, 0, 0);
             mSecurityState.setCompoundDrawablePadding(0);
         }
     }