Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5599)

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/toolbar/CustomTabToolbar.java

Issue 2438413002: [Offline pages] Reinstating the offline icon on tablet and fixing verbose state/URL emphasis (Closed)
Patch Set: Addressing comments and fixing compilation Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/android/java/src/org/chromium/chrome/browser/toolbar/CustomTabToolbar.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/toolbar/CustomTabToolbar.java b/chrome/android/java/src/org/chromium/chrome/browser/toolbar/CustomTabToolbar.java
index e83afab71f8f3fc6ef68e1be666f62764b11ab16..6b987a8142cca63eb5373aecc695c6c071b1b437 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/toolbar/CustomTabToolbar.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/toolbar/CustomTabToolbar.java
@@ -497,29 +497,22 @@ public class CustomTabToolbar extends ToolbarLayout implements LocationBar,
mSecurityIconType = securityLevel;
+ boolean isSmallDevice = !DeviceFormFactor.isTablet(getContext());
boolean isOfflinePage = getCurrentTab() != null && getCurrentTab().isOfflinePage();
- boolean showSecurityButton = securityLevel != ConnectionSecurityLevel.NONE || isOfflinePage;
-
- if (securityLevel == ConnectionSecurityLevel.NONE) {
- if (isOfflinePage && mShowsOfflinePage != isOfflinePage) {
- TintedDrawable bolt = TintedDrawable.constructTintedDrawable(
- getResources(), R.drawable.offline_pin);
- bolt.setTint(mUseDarkColors ? mDarkModeTint : mLightModeTint);
- mSecurityButton.setImageDrawable(bolt);
- }
+
+ int id = LocationBarLayout.getSecurityIconResource(
+ securityLevel, isSmallDevice, isOfflinePage);
+ boolean showSecurityButton = true;
+ if (id == 0) {
+ // Hide the button if we don't have an actual icon to display.
+ showSecurityButton = false;
+ mSecurityButton.setImageDrawable(null);
} else {
- boolean isSmallDevice = !DeviceFormFactor.isTablet(getContext());
- int id = LocationBarLayout.getSecurityIconResource(securityLevel, isSmallDevice);
- if (id == 0) {
- // Hide the button if we don't have an actual icon to display.
- showSecurityButton = false;
- } else {
- // ImageView#setImageResource is no-op if given resource is the current one.
- mSecurityButton.setImageResource(id);
- mSecurityButton.setTint(
- LocationBarLayout.getColorStateList(securityLevel, getToolbarDataProvider(),
- getResources(), false /* omnibox is not opaque */));
- }
+ // ImageView#setImageResource is no-op if given resource is the current one.
+ mSecurityButton.setImageResource(id);
+ mSecurityButton.setTint(
+ LocationBarLayout.getColorStateList(securityLevel, getToolbarDataProvider(),
+ getResources(), false /* omnibox is not opaque */));
}
mShowsOfflinePage = isOfflinePage;

Powered by Google App Engine
This is Rietveld 408576698