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

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/omnibox/LocationBarLayout.java

Issue 2290953002: Fix security icon colors on light themes (Closed)
Patch Set: Created 4 years, 4 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
« no previous file with comments | « no previous file | chrome/android/java/src/org/chromium/chrome/browser/toolbar/CustomTabToolbar.java » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/android/java/src/org/chromium/chrome/browser/omnibox/LocationBarLayout.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/omnibox/LocationBarLayout.java b/chrome/android/java/src/org/chromium/chrome/browser/omnibox/LocationBarLayout.java
index 33f2331561176ae3e9de5f98b600a9740e467fe1..51b881ed23e1ae4ea7032577d4acce2f634034bd 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/omnibox/LocationBarLayout.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/omnibox/LocationBarLayout.java
@@ -1216,16 +1216,24 @@ public class LocationBarLayout extends FrameLayout implements OnClickListener,
* @param securityLevel The security level for which the color will be returned.
* @param provider The {@link ToolbarDataProvider}.
* @param resources The Resources for the Context.
+ * @param isOmniboxOpaque Whether the omnibox is an opaque color.
* @return The {@link ColorStateList} to use to tint the security state icon.
*/
- public static ColorStateList getColorStateList(
- int securityLevel, ToolbarDataProvider provider, Resources resources) {
+ public static ColorStateList getColorStateList(int securityLevel, ToolbarDataProvider provider,
+ Resources resources, boolean isOmniboxOpaque) {
ColorStateList list = null;
int color = provider.getPrimaryColor();
boolean needLightIcon = ColorUtils.shouldUseLightForegroundOnBackground(color);
if (provider.isIncognito() || needLightIcon) {
+ // For a dark theme color, use light icons.
list = ApiCompatibilityUtils.getColorStateList(resources, R.color.light_mode_tint);
+ } else if (!ColorUtils.isUsingDefaultToolbarColor(resources, color) && !isOmniboxOpaque) {
+ // For theme colors which are not dark and are also not
+ // light enough to warrant an opaque URL bar, use dark
+ // icons.
+ list = ApiCompatibilityUtils.getColorStateList(resources, R.color.dark_mode_tint);
} else {
+ // For the default toolbar color, use a green or red icon.
if (securityLevel == ConnectionSecurityLevel.SECURITY_ERROR) {
list = ApiCompatibilityUtils.getColorStateList(resources, R.color.google_red_700);
} else if (securityLevel == ConnectionSecurityLevel.SECURE
@@ -1251,8 +1259,9 @@ public class LocationBarLayout extends FrameLayout implements OnClickListener,
} else {
// ImageView#setImageResource is no-op if given resource is the current one.
mSecurityButton.setImageResource(id);
- mSecurityButton.setTint(
- getColorStateList(securityLevel, getToolbarDataProvider(), getResources()));
+ mSecurityButton.setTint(getColorStateList(securityLevel, getToolbarDataProvider(),
+ getResources(), ColorUtils.shouldUseOpaqueTextboxBackground(
+ getToolbarDataProvider().getPrimaryColor())));
}
boolean shouldEmphasizeHttpsScheme = shouldEmphasizeHttpsScheme();
« no previous file with comments | « no previous file | chrome/android/java/src/org/chromium/chrome/browser/toolbar/CustomTabToolbar.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698