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

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

Issue 2144443002: [android] Correct the URL scheme colors in the Omnibox. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Respond to comments. Created 4 years, 5 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/omnibox/OmniboxUrlEmphasizer.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/omnibox/OmniboxUrlEmphasizer.java b/chrome/android/java/src/org/chromium/chrome/browser/omnibox/OmniboxUrlEmphasizer.java
index 986ea1316f577234ab79e9a8578c4ff10845e0d9..4f46765edb04e3c6d9cb2dda2868ed6ff6ed5bc3 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/omnibox/OmniboxUrlEmphasizer.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/omnibox/OmniboxUrlEmphasizer.java
@@ -128,13 +128,9 @@ public class OmniboxUrlEmphasizer {
public static void emphasizeUrl(Spannable url, Resources resources, Profile profile,
int securityLevel, boolean isInternalPage,
boolean useDarkColors, boolean emphasizeHttpsScheme) {
- assert (securityLevel == ConnectionSecurityLevel.SECURITY_ERROR
- || securityLevel == ConnectionSecurityLevel.SECURITY_WARNING)
- ? emphasizeHttpsScheme
- : true;
+ assert useDarkColors ? true : !emphasizeHttpsScheme;
String urlString = url.toString();
-
EmphasizeComponentsResponse emphasizeResponse =
parseForEmphasizeComponents(profile, urlString);
@@ -149,29 +145,25 @@ public class OmniboxUrlEmphasizer {
int startHostIndex = emphasizeResponse.hostStart;
int endHostIndex = emphasizeResponse.hostStart + emphasizeResponse.hostLength;
- // Add the https scheme highlight
+ // Color the HTTPS scheme.
ForegroundColorSpan span;
if (emphasizeResponse.hasScheme()) {
int colorId = nonEmphasizedColorId;
- if (!isInternalPage && emphasizeHttpsScheme) {
+ if (!isInternalPage) {
boolean strikeThroughScheme = false;
switch (securityLevel) {
case ConnectionSecurityLevel.NONE:
- colorId = nonEmphasizedColorId;
- break;
+ // Intentional fall-through:
case ConnectionSecurityLevel.SECURITY_WARNING:
- colorId = R.color.url_emphasis_start_scheme_security_warning;
- strikeThroughScheme = true;
break;
case ConnectionSecurityLevel.SECURITY_ERROR:
- colorId = R.color.url_emphasis_start_scheme_security_error;
+ if (emphasizeHttpsScheme) colorId = R.color.google_red_700;
strikeThroughScheme = true;
break;
case ConnectionSecurityLevel.EV_SECURE:
- colorId = R.color.url_emphasis_start_scheme_ev_secure;
- break;
+ // Intentional fall-through:
case ConnectionSecurityLevel.SECURE:
- colorId = R.color.url_emphasis_start_scheme_secure;
+ if (emphasizeHttpsScheme) colorId = R.color.google_green_700;
break;
default:
assert false;

Powered by Google App Engine
This is Rietveld 408576698