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

Unified Diff: chrome/browser/ui/views/omnibox/omnibox_view_win.cc

Issue 12463042: Shows chrome-extension urls and greys out the whole url. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Implementation does not depend on having a host and fixed nits. Created 7 years, 9 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/browser/ui/views/omnibox/omnibox_view_win.cc
diff --git a/chrome/browser/ui/views/omnibox/omnibox_view_win.cc b/chrome/browser/ui/views/omnibox/omnibox_view_win.cc
index 03f188809fd98ee6b63723318d231f38c9d661c8..c926103c0c4711b25dd5327deb90e3f98f827eeb 100644
--- a/chrome/browser/ui/views/omnibox/omnibox_view_win.cc
+++ b/chrome/browser/ui/views/omnibox/omnibox_view_win.cc
@@ -2483,21 +2483,30 @@ void OmniboxViewWin::EmphasizeURLComponents() {
cf.dwMask = CFM_COLOR;
// If we're going to emphasize parts of the text, then the baseline state
// should be "de-emphasized". If not, then everything should be rendered in
- // the standard text color.
- cf.crTextColor = skia::SkColorToCOLORREF(parent_view_->GetColor(
- security_level_,
- emphasize ? LocationBarView::DEEMPHASIZED_TEXT : LocationBarView::TEXT));
- // NOTE: Don't use SetDefaultCharFormat() instead of the below; that sets the
- // format that will get applied to text added in the future, not to text
- // already in the edit.
- SelectAll(false);
- SetSelectionCharFormat(cf);
-
- if (emphasize) {
- // We've found a host name, give it more emphasis.
+ // the standard text color unless we should grey out the entire URL.
+ if (model()->CurrentTextIsURL() &&
Peter Kasting 2013/04/04 21:07:05 Nit: Slightly simpler: bool grey_base = model()
Patrick Riordan 2013/04/10 02:00:24 Done.
+ (host.is_nonempty() || toolbar_model()->ShouldGreyOutURL())) {
+ cf.crTextColor = skia::SkColorToCOLORREF(parent_view_->GetColor(
+ security_level_, LocationBarView::DEEMPHASIZED_TEXT));
+ // NOTE: Don't use SetDefaultCharFormat() instead of the below; that sets
+ // the format that will get applied to text added in the future, not to text
+ // already in the edit.
+ SelectAll(false);
+ SetSelectionCharFormat(cf);
+
+ if (host.is_nonempty() && !toolbar_model()->ShouldGreyOutURL()) {
+ // We've found a host name and we should provide emphasis to host names,
+ // so emphasize it.
+ cf.crTextColor = skia::SkColorToCOLORREF(parent_view_->GetColor(
+ security_level_, LocationBarView::TEXT));
+ SetSelection(host.begin, host.end());
+ SetSelectionCharFormat(cf);
+ }
+ } else {
cf.crTextColor = skia::SkColorToCOLORREF(parent_view_->GetColor(
security_level_, LocationBarView::TEXT));
- SetSelection(host.begin, host.end());
+ // NOTE: Don't use SetDefaultCharFormat(). See above.
+ SelectAll(false);
SetSelectionCharFormat(cf);
}

Powered by Google App Engine
This is Rietveld 408576698