Bug 1248437 - Replace site security icon with search icon on about:home. r=ahunt
MozReview-Commit-ID: 53HNhoAqMFe
--- a/mobile/android/base/java/org/mozilla/gecko/toolbar/ToolbarDisplayLayout.java
+++ b/mobile/android/base/java/org/mozilla/gecko/toolbar/ToolbarDisplayLayout.java
@@ -115,16 +115,18 @@ public class ToolbarDisplayLayout extend
// Default level (unverified pages) - globe icon:
private static final int LEVEL_DEFAULT_GLOBE = 0;
// Levels for displaying Mixed Content state icons.
private static final int LEVEL_WARNING_MINOR = 3;
private static final int LEVEL_LOCK_DISABLED = 4;
// Levels for displaying Tracking Protection state icons.
private static final int LEVEL_SHIELD_ENABLED = 5;
private static final int LEVEL_SHIELD_DISABLED = 6;
+ // Icon used for about:home
+ private static final int LEVEL_SEARCH_ICON = 999;
private final ForegroundColorSpan mBlockedColor;
public ToolbarDisplayLayout(Context context, AttributeSet attrs) {
super(context, attrs);
setOrientation(HORIZONTAL);
mActivity = (BrowserApp) context;
@@ -312,17 +314,20 @@ public class ToolbarDisplayLayout extend
// SecurityMode.CHROMEUI has a different ordinal - hence we need to manually reset it here.
// (We then continue and process the tracking / mixed content icons as usual, even for about: pages, as they
// can still load external sites.)
if (securityMode == SecurityMode.CHROMEUI) {
imageLevel = LEVEL_DEFAULT_GLOBE; // == SecurityMode.UNKNOWN.ordinal()
}
// Check to see if any protection was overridden first
- if (loginInsecure) {
+ if (AboutPages.isTitlelessAboutPage(tab.getURL())) {
+ // We always want to just show a search icon on about:home
+ imageLevel = LEVEL_SEARCH_ICON;
+ } else if (loginInsecure) {
imageLevel = LEVEL_LOCK_DISABLED;
} else if (trackingMode == TrackingMode.TRACKING_CONTENT_LOADED) {
imageLevel = LEVEL_SHIELD_DISABLED;
} else if (trackingMode == TrackingMode.TRACKING_CONTENT_BLOCKED) {
imageLevel = LEVEL_SHIELD_ENABLED;
} else if (activeMixedMode == MixedMode.MIXED_CONTENT_LOADED) {
imageLevel = LEVEL_LOCK_DISABLED;
} else if (displayMixedMode == MixedMode.MIXED_CONTENT_LOADED) {
--- a/mobile/android/base/resources/drawable/site_security_level.xml
+++ b/mobile/android/base/resources/drawable/site_security_level.xml
@@ -8,9 +8,11 @@
<item android:maxLevel="0" android:drawable="@drawable/site_security_unknown"/>
<item android:maxLevel="1" android:drawable="@drawable/lock_secure"/>
<item android:maxLevel="2" android:drawable="@drawable/lock_secure"/>
<item android:maxLevel="3" android:drawable="@drawable/warning_minor"/>
<item android:maxLevel="4" android:drawable="@drawable/lock_disabled"/>
<item android:maxLevel="5" android:drawable="@drawable/shield_enabled"/>
<item android:maxLevel="6" android:drawable="@drawable/shield_disabled"/>
+ <!-- Special icon used for about:home -->
+ <item android:maxLevel="999" android:drawable="@drawable/search_icon_inactive" />
</level-list>