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

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

Issue 2063823005: [android] New origin security indicator icons. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Optimized PNGs. Created 4 years, 6 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 1d8fdd9706e3d79a27bc666935e6210eeaf936ea..e07027fb68e0ae5704858fc64a912d90a595d9bd 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
@@ -28,7 +28,6 @@ import android.view.MotionEvent;
import android.view.View;
import android.widget.FrameLayout;
import android.widget.ImageButton;
-import android.widget.ImageView;
import android.widget.TextView;
import org.chromium.base.ApiCompatibilityUtils;
@@ -52,9 +51,11 @@ import org.chromium.chrome.browser.tab.Tab;
import org.chromium.chrome.browser.toolbar.ActionModeController.ActionBarDelegate;
import org.chromium.chrome.browser.util.ColorUtils;
import org.chromium.chrome.browser.widget.TintedDrawable;
+import org.chromium.chrome.browser.widget.TintedImageButton;
import org.chromium.components.dom_distiller.core.DomDistillerService;
import org.chromium.components.dom_distiller.core.DomDistillerUrlUtils;
import org.chromium.components.security_state.ConnectionSecurityLevel;
+import org.chromium.ui.base.DeviceFormFactor;
import org.chromium.ui.base.WindowAndroid;
import org.chromium.ui.interpolators.BakedBezierInterpolator;
import org.chromium.ui.widget.Toast;
@@ -93,7 +94,7 @@ public class CustomTabToolbar extends ToolbarLayout implements LocationBar,
private View mTitleUrlContainer;
private UrlBar mUrlBar;
private TextView mTitleBar;
- private ImageView mSecurityButton;
+ private TintedImageButton mSecurityButton;
private ImageButton mCustomActionButton;
private int mSecurityIconType;
private ImageButton mCloseButton;
@@ -137,7 +138,7 @@ public class CustomTabToolbar extends ToolbarLayout implements LocationBar,
mLocationBarFrameLayout = findViewById(R.id.location_bar_frame_layout);
mTitleUrlContainer = findViewById(R.id.title_url_container);
mTitleUrlContainer.setOnLongClickListener(this);
- mSecurityButton = (ImageButton) findViewById(R.id.security_button);
+ mSecurityButton = (TintedImageButton) findViewById(R.id.security_button);
mSecurityIconType = ConnectionSecurityLevel.NONE;
mCustomActionButton = (ImageButton) findViewById(R.id.action_button);
mCustomActionButton.setOnLongClickListener(this);
@@ -232,11 +233,8 @@ public class CustomTabToolbar extends ToolbarLayout implements LocationBar,
@Override
public boolean shouldEmphasizeHttpsScheme() {
int securityLevel = getSecurityLevel();
- if (securityLevel == ConnectionSecurityLevel.SECURITY_ERROR
- || securityLevel == ConnectionSecurityLevel.SECURITY_POLICY_WARNING) {
- return true;
- }
- return false;
+ return securityLevel == ConnectionSecurityLevel.SECURITY_ERROR
+ || securityLevel == ConnectionSecurityLevel.SECURITY_POLICY_WARNING;
}
@Override
@@ -482,13 +480,15 @@ public class CustomTabToolbar extends ToolbarLayout implements LocationBar,
if (securityLevel == ConnectionSecurityLevel.NONE) {
mAnimDelegate.hideSecurityButton();
} else {
- int id = LocationBarLayout.getSecurityIconResource(
- securityLevel, !shouldEmphasizeHttpsScheme());
- // ImageView#setImageResource is no-op if given resource is the current one.
+ boolean isSmallDevice = !DeviceFormFactor.isTablet(getContext());
+ int id = LocationBarLayout.getSecurityIconResource(securityLevel, isSmallDevice);
if (id == 0) {
mSecurityButton.setImageDrawable(null);
} else {
+ // ImageView#setImageResource is no-op if given resource is the current one.
mSecurityButton.setImageResource(id);
+ mSecurityButton.setTint(LocationBarLayout.getColorStateList(
+ securityLevel, getToolbarDataProvider(), getResources()));
}
mAnimDelegate.showSecurityButton();
}

Powered by Google App Engine
This is Rietveld 408576698