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

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

Issue 2274973004: Fix security icon colors on light themes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: indentation fix 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 15bba2f6110b25e7908fc707b0d549ff4fc0e606..ffc3dc48ed7f24ac0a908710b386b771b8350d15 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
@@ -1226,16 +1226,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
@@ -1261,8 +1269,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