Chromium Code Reviews| 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 d82e4b675ef266b88a1f40269d924c7f2e701eb4..2c1bb9c561cac8812ae5cd881ff6732e50a7aaed 100644 |
| --- a/chrome/browser/ui/cocoa/omnibox/omnibox_view_mac.mm |
| +++ b/chrome/browser/ui/cocoa/omnibox/omnibox_view_mac.mm |
| @@ -86,29 +86,29 @@ NSColor* ColorWithRGBBytes(int rr, int gg, int bb) { |
| alpha:1.0]; |
| } |
| -NSColor* HostTextColor(bool inDarkMode) { |
| +NSColor* HostTextColor(bool in_dark_mode) { |
| if (!ui::MaterialDesignController::IsModeMaterial()) { |
| return [NSColor blackColor]; |
| } |
| - return inDarkMode ? [NSColor whiteColor] : [NSColor blackColor]; |
| + return in_dark_mode ? [NSColor whiteColor] : [NSColor blackColor]; |
| } |
| -NSColor* SecureSchemeColor(bool inDarkMode) { |
| +NSColor* SecureSchemeColor(bool in_dark_mode) { |
| if (!ui::MaterialDesignController::IsModeMaterial()) { |
| return ColorWithRGBBytes(0x07, 0x95, 0x00); |
| } |
| - return inDarkMode ? [NSColor colorWithCalibratedWhite:1 alpha:0.5] : |
| - skia::SkColorToCalibratedNSColor(gfx::kGoogleGreen700); |
| + return in_dark_mode ? [NSColor colorWithCalibratedWhite:1 alpha:0.5] : |
| + skia::SkColorToCalibratedNSColor(gfx::kGoogleGreen700); |
| } |
| -NSColor* SecurityWarningSchemeColor(bool inDarkMode) { |
| - return inDarkMode ? [NSColor colorWithCalibratedWhite:1 alpha:0.5] : |
| - skia::SkColorToCalibratedNSColor(gfx::kGoogleYellow700); |
| +NSColor* SecurityWarningSchemeColor(bool in_dark_mode) { |
| + return in_dark_mode ? [NSColor colorWithCalibratedWhite:1 alpha:0.5] : |
| + skia::SkColorToCalibratedNSColor(gfx::kGoogleYellow700); |
| } |
| -NSColor* SecurityErrorSchemeColor(bool inDarkMode) { |
| +NSColor* SecurityErrorSchemeColor(bool in_dark_mode) { |
| if (!ui::MaterialDesignController::IsModeMaterial()) { |
| return ColorWithRGBBytes(0xa2, 0x00, 0x00); |
| } |
| - return inDarkMode ? [NSColor colorWithCalibratedWhite:1 alpha:0.5] : |
| - skia::SkColorToCalibratedNSColor(gfx::kGoogleRed700); |
| + return in_dark_mode ? [NSColor colorWithCalibratedWhite:1 alpha:0.5] : |
| + skia::SkColorToCalibratedNSColor(gfx::kGoogleRed700); |
| } |
| const char kOmniboxViewMacStateKey[] = "OmniboxViewMacState"; |
| @@ -545,7 +545,7 @@ void OmniboxViewMac::ApplyTextAttributes( |
| NSMutableAttributedString* attributedString) { |
| NSUInteger as_length = [attributedString length]; |
| NSRange as_entire_string = NSMakeRange(0, as_length); |
| - bool inDarkMode = [[field_ window] inIncognitoModeWithSystemTheme]; |
| + bool in_dark_mode = [[field_ window] inIncognitoModeWithSystemTheme]; |
| ApplyTextStyle(attributedString); |
| @@ -555,6 +555,17 @@ void OmniboxViewMac::ApplyTextAttributes( |
| value:@"en_US_POSIX" |
| range:as_entire_string]; |
| + // Under Material Design, force the text to be a single color white editing. |
| + if (ui::MaterialDesignController::IsModeMaterial() && |
| + [field_ currentEditor]) { |
| + if (as_length) { |
|
tapted
2016/05/02 23:49:03
nit: other places in this method don't check for a
shrike
2016/05/03 00:00:33
The other blocks of code do check for an empty str
|
| + [attributedString addAttribute:NSForegroundColorAttributeName |
| + value:HostTextColor(in_dark_mode) |
| + range:as_entire_string]; |
| + } |
| + return; |
| + } |
| + |
| url::Component scheme, host; |
| AutocompleteInput::ParseForEmphasizeComponents( |
| display_text, ChromeAutocompleteSchemeClassifier(profile_), &scheme, |
| @@ -564,12 +575,12 @@ void OmniboxViewMac::ApplyTextAttributes( |
| if (model()->CurrentTextIsURL() && |
| (host.is_nonempty() || grey_out_url)) { |
| [attributedString addAttribute:NSForegroundColorAttributeName |
| - value:BaseTextColor(inDarkMode) |
| + value:BaseTextColor(in_dark_mode) |
| range:as_entire_string]; |
| if (!grey_out_url) { |
| [attributedString addAttribute:NSForegroundColorAttributeName |
| - value:HostTextColor(inDarkMode) |
| + value:HostTextColor(in_dark_mode) |
| range:ComponentToNSRange(host)]; |
| } |
| } |
| @@ -587,20 +598,20 @@ void OmniboxViewMac::ApplyTextAttributes( |
| NSColor* color; |
| if (security_level == security_state::SecurityStateModel::EV_SECURE || |
| security_level == security_state::SecurityStateModel::SECURE) { |
| - color = SecureSchemeColor(inDarkMode); |
| + color = SecureSchemeColor(in_dark_mode); |
| } else if (security_level == |
| security_state::SecurityStateModel::SECURITY_ERROR) { |
| - color = SecurityErrorSchemeColor(inDarkMode); |
| + color = SecurityErrorSchemeColor(in_dark_mode); |
| // Add a strikethrough through the scheme. |
| [attributedString addAttribute:NSStrikethroughStyleAttributeName |
| value:[NSNumber numberWithInt:NSUnderlineStyleSingle] |
| range:ComponentToNSRange(scheme)]; |
| } else if (security_level == |
| security_state::SecurityStateModel::SECURITY_WARNING) { |
| - color = SecurityWarningSchemeColor(inDarkMode); |
| + color = SecurityWarningSchemeColor(in_dark_mode); |
| } else { |
| NOTREACHED(); |
| - color = BaseTextColor(inDarkMode); |
| + color = BaseTextColor(in_dark_mode); |
| } |
| [attributedString addAttribute:NSForegroundColorAttributeName |
| value:color |