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

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: No longer involves toolbar model Created 7 years, 8 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 970d879b58478d805042d57f7084d760392b01ff..20ef1d2564cf745b098b4e798b989d3881a64fcf 100644
--- a/chrome/browser/ui/views/omnibox/omnibox_view_win.cc
+++ b/chrome/browser/ui/views/omnibox/omnibox_view_win.cc
@@ -43,6 +43,7 @@
#include "chrome/common/chrome_notification_types.h"
#include "content/public/browser/user_metrics.h"
#include "content/public/browser/web_contents.h"
+#include "extensions/common/constants.h"
#include "googleurl/src/url_util.h"
#include "grit/generated_resources.h"
#include "net/base/escape.h"
@@ -2474,25 +2475,28 @@ void OmniboxViewWin::EmphasizeURLComponents() {
// And Go system uses.
url_parse::Component scheme, host;
AutocompleteInput::ParseForEmphasizeComponents(GetText(), &scheme, &host);
Peter Kasting 2013/04/11 23:10:40 Pull this GetText() call out into a string16 temp
Patrick Riordan 2013/04/11 23:27:38 Done.
- const bool emphasize = model()->CurrentTextIsURL() && (host.len > 0);
// Set the baseline emphasis.
CHARFORMAT cf = {0};
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.
+ // the standard text color unless we should grey out the entire URL.
+ bool grey_out_url = GetText().substr(scheme.begin, scheme.len) ==
+ UTF8ToUTF16(extensions::kExtensionScheme);
+ bool grey_base = model()->CurrentTextIsURL() &&
+ (host.is_nonempty() || grey_out_url);
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
+ grey_base ? 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.
+ if (host.is_nonempty() && !grey_out_url) {
+ // 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());

Powered by Google App Engine
This is Rietveld 408576698