Index: chrome/browser/ui/cocoa/omnibox/omnibox_view_mac.mm |
diff --git a/chrome/browser/ui/cocoa/omnibox/omnibox_view_mac.mm b/chrome/browser/ui/cocoa/omnibox/omnibox_view_mac.mm |
index cd2b95faefb8470578fb8128da5b00a47359f88f..c96da3aee711d82540cedb9978bfa1949d089f8a 100644 |
--- a/chrome/browser/ui/cocoa/omnibox/omnibox_view_mac.mm |
+++ b/chrome/browser/ui/cocoa/omnibox/omnibox_view_mac.mm |
@@ -571,8 +571,18 @@ void OmniboxViewMac::ApplyTextAttributes( |
AutocompleteInput::ParseForEmphasizeComponents( |
display_text, ChromeAutocompleteSchemeClassifier(profile_), &scheme, |
&host); |
- bool grey_out_url = display_text.substr(scheme.begin, scheme.len) == |
- base::UTF8ToUTF16(extensions::kExtensionScheme); |
+ |
+ const base::string16 url_scheme = |
+ display_text.substr(scheme.begin, scheme.len); |
+ |
+ // Is the scheme one that might be abused for spoofing purposes? |
+ bool spoofy_scheme = url_scheme == base::UTF8ToUTF16(url::kDataScheme); |
+ |
+ // Should the full URL be deemphasized? |
+ bool grey_out_url = |
+ (spoofy_scheme || |
+ url_scheme == base::UTF8ToUTF16(extensions::kExtensionScheme)); |
+ |
if (model()->CurrentTextIsURL() && |
(host.is_nonempty() || grey_out_url)) { |
[attributedString addAttribute:NSForegroundColorAttributeName |
@@ -583,6 +593,10 @@ void OmniboxViewMac::ApplyTextAttributes( |
[attributedString addAttribute:NSForegroundColorAttributeName |
value:HostTextColor(in_dark_mode) |
range:ComponentToNSRange(host)]; |
+ } else if (spoofy_scheme) { |
+ [attributedString addAttribute:NSForegroundColorAttributeName |
+ value:HostTextColor(in_dark_mode) |
+ range:ComponentToNSRange(scheme)]; |
} |
} |