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

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

Issue 749283006: Revert of Updated the omnibox on Android to color URLs correctly (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@url_coloring_unittests
Patch Set: Created 6 years 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 69de2d7befe89c2f3fa36aafd67582fb9ed1aa2a..c9bd8cbe990672862204e95f83e950864517a27a 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
@@ -108,26 +108,11 @@
/**
* Make the whole url greyed out (trailing url color).
- * TODO(sashab): Remove this method. For backwards compatibility only.
*
* @param url The URL spannable to grey out. This variable is modified.
* @param resources Resources for the given application context.
*/
public static void greyOutUrl(Spannable url, Resources resources) {
- UrlEmphasisColorSpan span = new UrlEmphasisColorSpan(
- resources.getColor(R.color.url_emphasis_trailing_url));
- url.setSpan(span, 0, url.toString().length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
- }
-
- /**
- * Make the whole url greyed out (trailing url color).
- *
- * @param url The URL spannable to grey out. This variable is modified.
- * @param resources Resources for the given application context.
- * @param useDarkColors Whether the text colors should be dark (i.e.
- * appropriate for use on a light background).
- */
- public static void greyOutUrl(Spannable url, Resources resources, boolean useDarkColors) {
UrlEmphasisColorSpan span = new UrlEmphasisColorSpan(
resources.getColor(R.color.url_emphasis_trailing_url));
url.setSpan(span, 0, url.toString().length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
@@ -153,11 +138,6 @@
EmphasizeComponentsResponse emphasizeResponse =
parseForEmphasizeComponents(profile, urlString);
- int nonEmphasizedColorId = R.color.url_emphasis_non_emphasized_text;
- if (!useDarkColors) {
- nonEmphasizedColorId = R.color.url_emphasis_light_non_emphasized_text;
- }
-
int startSchemeIndex = emphasizeResponse.schemeStart;
int endSchemeIndex = emphasizeResponse.schemeStart + emphasizeResponse.schemeLength;
@@ -167,11 +147,13 @@
// Add the https scheme highlight
ForegroundColorSpan span;
if (emphasizeResponse.hasScheme()) {
- int colorId = nonEmphasizedColorId;
- if (!isInternalPage) {
+ int colorId = R.color.url_emphasis_scheme_to_domain;
+ if (isInternalPage) {
+ colorId = R.color.url_emphasis_trailing_url;
+ } else {
switch (securityLevel) {
case ToolbarModelSecurityLevel.NONE:
- colorId = nonEmphasizedColorId;
+ colorId = R.color.url_emphasis_scheme_to_domain;
break;
case ToolbarModelSecurityLevel.SECURITY_WARNING:
colorId = R.color.url_emphasis_start_scheme_security_warning;
@@ -200,7 +182,8 @@
// https, this will be ://. For normal pages, this will be empty as we trim off
// http://.
if (emphasizeResponse.hasHost()) {
- span = new UrlEmphasisColorSpan(resources.getColor(nonEmphasizedColorId));
+ span = new UrlEmphasisColorSpan(
+ resources.getColor(R.color.url_emphasis_scheme_to_domain));
url.setSpan(span, endSchemeIndex, startHostIndex,
Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
}
@@ -217,7 +200,8 @@
// Highlight the remainder of the URL.
if (endHostIndex < urlString.length()) {
- span = new UrlEmphasisColorSpan(resources.getColor(nonEmphasizedColorId));
+ span = new UrlEmphasisColorSpan(
+ resources.getColor(R.color.url_emphasis_trailing_url));
url.setSpan(span, endHostIndex, urlString.length(),
Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
}

Powered by Google App Engine
This is Rietveld 408576698