Chromium Code Reviews| Index: components/omnibox/browser/omnibox_view.cc |
| diff --git a/components/omnibox/browser/omnibox_view.cc b/components/omnibox/browser/omnibox_view.cc |
| index 8fe1c80e70e143dbc7b5732afc759ea50e1d9b3f..ddb9214c097adea0fa4d9b458c7ce20545c0fdcc 100644 |
| --- a/components/omnibox/browser/omnibox_view.cc |
| +++ b/components/omnibox/browser/omnibox_view.cc |
| @@ -185,3 +185,29 @@ void OmniboxView::TextChanged() { |
| if (model_.get()) |
| model_->OnChanged(); |
| } |
| + |
| +OmniboxView::DEEMPHASIZE_COMPONENTS OmniboxView::GetDeemphasis( |
| + const base::string16& url_scheme, |
| + const bool has_host) const { |
| + OmniboxView::DEEMPHASIZE_COMPONENTS deemphasize = NOTHING; |
|
Peter Kasting
2017/02/24 01:53:40
Nit: Can remove this variable, change assignments
|
| + |
| + // This constant is copied from extensions/common/constants.h to avoid |
| + // complicated dependencies. |
|
Peter Kasting
2017/02/24 01:53:40
Urgh.
Can we not have extensions/common/ in compo
|
| + const char kExtensionScheme[] = "chrome-extension"; |
| + |
| + if (model_->CurrentTextIsURL()) { |
| + // Extension IDs are not human-readable, so deemphasize everything to draw |
| + // attention to the human-readable name in the location icon text. |
| + if (url_scheme == base::UTF8ToUTF16(kExtensionScheme)) |
| + deemphasize = EVERYTHING; |
| + // Data URLs are rarely human-readable and can be used for spoofing, so draw |
| + // attention to the scheme to emphasize "this is just a bunch of data". |
| + else if (url_scheme == base::UTF8ToUTF16(url::kDataScheme)) |
| + deemphasize = ALL_BUT_SCHEME; |
| + // For normal URLs, the host is the best proxy for "identity". |
| + else if (has_host) |
| + deemphasize = ALL_BUT_HOST; |
| + } |
| + |
| + return deemphasize; |
| +} |