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..f239ea57b2dfdd1fc09b236e4baeabec92a51612 100644 |
--- a/chrome/browser/ui/cocoa/omnibox/omnibox_view_mac.mm |
+++ b/chrome/browser/ui/cocoa/omnibox/omnibox_view_mac.mm |
@@ -563,27 +563,32 @@ void OmniboxViewMac::ApplyTextAttributes( |
value:@"en_US_POSIX" |
range:as_entire_string]; |
- [attributedString addAttribute:NSForegroundColorAttributeName |
- value:HostTextColor(in_dark_mode) |
- range:as_entire_string]; |
- |
url::Component scheme, host; |
AutocompleteInput::ParseForEmphasizeComponents( |
display_text, ChromeAutocompleteSchemeClassifier(profile_), &scheme, |
&host); |
- bool grey_out_url = display_text.substr(scheme.begin, scheme.len) == |
- base::UTF8ToUTF16(extensions::kExtensionScheme); |
- if (model()->CurrentTextIsURL() && |
- (host.is_nonempty() || grey_out_url)) { |
- [attributedString addAttribute:NSForegroundColorAttributeName |
- value:BaseTextColor(in_dark_mode) |
- range:as_entire_string]; |
- if (!grey_out_url) { |
- [attributedString addAttribute:NSForegroundColorAttributeName |
- value:HostTextColor(in_dark_mode) |
- range:ComponentToNSRange(host)]; |
- } |
+ const base::string16 url_scheme = |
+ display_text.substr(scheme.begin, scheme.len); |
+ |
+ // Determine if any url components should be visually deemphasized. |
+ DEEMPHASIZE_COMPONENTS deemphasize = |
+ GetDeemphasis(url_scheme, host.is_nonempty()); |
+ |
+ [attributedString |
+ addAttribute:NSForegroundColorAttributeName |
+ value:(deemphasize == NOTHING) ? HostTextColor(in_dark_mode) |
+ : BaseTextColor(in_dark_mode) |
+ range:as_entire_string]; |
+ |
+ if (deemphasize == ALL_BUT_SCHEME) { |
+ [attributedString addAttribute:NSForegroundColorAttributeName |
+ value:HostTextColor(in_dark_mode) |
+ range:ComponentToNSRange(scheme)]; |
+ } else if (deemphasize == ALL_BUT_HOST) { |
+ [attributedString addAttribute:NSForegroundColorAttributeName |
+ value:HostTextColor(in_dark_mode) |
+ range:ComponentToNSRange(host)]; |
} |
// TODO(shess): GTK has this as a member var, figure out why. |