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..3187232839db9b3b9ae7ea6c6adca5f04814a025 100644 |
| --- a/chrome/browser/ui/views/omnibox/omnibox_view_views.cc |
| +++ b/chrome/browser/ui/views/omnibox/omnibox_view_views.cc |
| @@ -586,14 +586,27 @@ void OmniboxViewViews::EmphasizeURLComponents() { |
| url::Component scheme, host; |
| AutocompleteInput::ParseForEmphasizeComponents( |
| text(), ChromeAutocompleteSchemeClassifier(profile_), &scheme, &host); |
| - bool grey_out_url = text().substr(scheme.begin, scheme.len) == |
| - base::UTF8ToUTF16(extensions::kExtensionScheme); |
| + |
| + const base::string16 url_scheme = text().substr(scheme.begin, scheme.len); |
| + |
| + // Is the scheme one that might be abused for spoofing purposes? |
|
Peter Kasting
2017/02/06 22:42:28
ALl this code feels a little piecemeal to me; the
|
| + bool spoofy_scheme = url_scheme == base::UTF8ToUTF16(url::kDataScheme); |
|
Peter Kasting
2017/02/06 22:42:28
Should we just go ahead and include blob: in this?
|
| + |
| + // Should the entire URL be deemphasized? |
| + bool grey_out_url = |
| + (spoofy_scheme || |
| + url_scheme == base::UTF8ToUTF16(extensions::kExtensionScheme)); |
| + |
| bool grey_base = text_is_url && (host.is_nonempty() || grey_out_url); |
| + |
|
Peter Kasting
2017/02/06 22:42:28
Nit: I wouldn't add this
|
| 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())); |
| + } else if (spoofy_scheme) { |
| + ApplyColor(location_bar_view_->GetColor(LocationBarView::TEXT), |
| + gfx::Range(scheme.begin, scheme.end())); |
| } |
| // Emphasize the scheme for security UI display purposes (if necessary). |