Chromium Code Reviews| Index: chrome/browser/ui/views/omnibox/omnibox_view_views.cc |
| diff --git a/chrome/browser/ui/views/omnibox/omnibox_view_views.cc b/chrome/browser/ui/views/omnibox/omnibox_view_views.cc |
| index 0f22b6ee6e9593c66759e2e7ab82f406c59e5b0f..f56e7315a49cf0632dcb72d14377a88b0b5db2fb 100644 |
| --- a/chrome/browser/ui/views/omnibox/omnibox_view_views.cc |
| +++ b/chrome/browser/ui/views/omnibox/omnibox_view_views.cc |
| @@ -31,7 +31,6 @@ |
| #include "components/strings/grit/components_strings.h" |
| #include "components/toolbar/toolbar_model.h" |
| #include "content/public/browser/web_contents.h" |
| -#include "extensions/common/constants.h" |
| #include "net/base/escape.h" |
| #include "third_party/skia/include/core/SkColor.h" |
| #include "ui/accessibility/ax_action_data.h" |
| @@ -586,15 +585,22 @@ void OmniboxViewViews::EmphasizeURLComponents() { |
| url::Component scheme, host; |
| AutocompleteInput::ParseForEmphasizeComponents( |
| text(), ChromeAutocompleteSchemeClassifier(profile_), &scheme, &host); |
|
Peter Kasting
2017/02/24 01:53:40
Can we hoist this block and |url_scheme| to GetDee
|
| - bool grey_out_url = text().substr(scheme.begin, scheme.len) == |
| - base::UTF8ToUTF16(extensions::kExtensionScheme); |
| - bool grey_base = text_is_url && (host.is_nonempty() || grey_out_url); |
| - SetColor(location_bar_view_->GetColor( |
| - grey_base ? LocationBarView::DEEMPHASIZED_TEXT : LocationBarView::TEXT)); |
| - if (grey_base && !grey_out_url) { |
| - ApplyColor(location_bar_view_->GetColor(LocationBarView::TEXT), |
| - gfx::Range(host.begin, host.end())); |
| - } |
| + |
| + const base::string16 url_scheme = text().substr(scheme.begin, scheme.len); |
| + |
| + // Determine if any url components should be visually deemphasized. |
| + DEEMPHASIZE_COMPONENTS deemphasize = |
| + GetDeemphasis(url_scheme, host.is_nonempty()); |
| + |
| + const SkColor emphasized_color = |
| + location_bar_view_->GetColor(LocationBarView::TEXT); |
| + SetColor(deemphasize == NOTHING ? emphasized_color |
| + : location_bar_view_->GetColor( |
| + LocationBarView::DEEMPHASIZED_TEXT)); |
| + if (deemphasize == ALL_BUT_SCHEME) |
| + ApplyColor(emphasized_color, gfx::Range(scheme.begin, scheme.end())); |
| + else if (deemphasize == ALL_BUT_HOST) |
| + ApplyColor(emphasized_color, gfx::Range(host.begin, host.end())); |
| // Emphasize the scheme for security UI display purposes (if necessary). |
| // Note that we check CurrentTextIsURL() because if we're replacing search |