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

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

Issue 706113006: Leave the '://' grey in android's page info dialog. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Formatting Created 6 years, 1 month 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 | no next file » | 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/WebsiteSettingsPopup.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/WebsiteSettingsPopup.java b/chrome/android/java/src/org/chromium/chrome/browser/WebsiteSettingsPopup.java
index 21405d1fa2c285dc1422a43055209026ab8f284c..8e0c180ec3d69b6fc8427b75799eecc58b8b3989 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/WebsiteSettingsPopup.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/WebsiteSettingsPopup.java
@@ -291,7 +291,8 @@ public class WebsiteSettingsPopup implements OnClickListener, OnItemSelectedList
schemeColorId = getSchemeColorId(securityLevel);
}
- sb.append(parsedUrl.toString());
+ String parsedUrlString = parsedUrl.toString();
+ sb.append(parsedUrlString);
final ForegroundColorSpan schemeColorSpan = new ForegroundColorSpan(
mContext.getResources().getColor(schemeColorId));
sb.setSpan(schemeColorSpan, 0, parsedUrl.getScheme().length(),
@@ -301,12 +302,26 @@ public class WebsiteSettingsPopup implements OnClickListener, OnItemSelectedList
Spannable.SPAN_INCLUSIVE_EXCLUSIVE);
}
- // The domain is everything after the scheme until the end of the origin.
+ // The domain does not include the '://'.
+ String originToDisplay = UrlUtilities.getOriginForDisplay(parsedUrl, false);
+ int originBegin = parsedUrlString.indexOf(originToDisplay,
+ parsedUrl.getScheme().length());
+ int originEnd = originBegin + originToDisplay.length();
+
+ // In some cases (e.g. 'about:blank') UrlUtilities.getOriginForDisplay will return the
+ // entire URL. In these cases originBegin will now be -1.
+ if (originBegin < 0) {
+ originBegin = parsedUrl.getScheme().length();
+ // Don't include the ':' in the origin for highlighting if present (it should always
+ // be there but check to be sure).
+ if (originBegin < parsedUrlString.length()) originBegin++;
+
+ originEnd = parsedUrlString.length();
+ }
+
final ForegroundColorSpan domainColorSpan = new ForegroundColorSpan(
mContext.getResources().getColor(R.color.website_settings_popup_url_domain));
- sb.setSpan(domainColorSpan, parsedUrl.getScheme().length(),
- UrlUtilities.getOriginForDisplay(parsedUrl, true).length(),
- Spannable.SPAN_INCLUSIVE_EXCLUSIVE);
+ sb.setSpan(domainColorSpan, originBegin, originEnd, Spannable.SPAN_INCLUSIVE_EXCLUSIVE);
mUrlTitle.setText(sb);
} else {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698