| 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..3c7943512fce1dce3b9b73b6205769eda85aab44 100644
|
| --- a/chrome/browser/ui/cocoa/omnibox/omnibox_view_mac.mm
|
| +++ b/chrome/browser/ui/cocoa/omnibox/omnibox_view_mac.mm
|
| @@ -32,6 +32,8 @@
|
| #include "components/toolbar/toolbar_model.h"
|
| #include "content/public/browser/web_contents.h"
|
| #include "extensions/common/constants.h"
|
| +#include "grit/components_scaled_resources.h"
|
| +#include "grit/theme_resources.h"
|
| #import "skia/ext/skia_utils_mac.h"
|
| #import "third_party/mozilla/NSPasteboard+Utils.h"
|
| #include "ui/base/clipboard/clipboard.h"
|
| @@ -86,29 +88,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 +547,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);
|
|
|
| @@ -564,12 +566,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 +589,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
|
| @@ -1101,7 +1103,13 @@ NSFont* OmniboxViewMac::GetLargeFont(int style) {
|
|
|
| NSFont* OmniboxViewMac::GetSmallFont(int style) {
|
| ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
|
| - return rb.GetFontList(ui::ResourceBundle::SmallFont)
|
| + if (!ui::MaterialDesignController::IsModeMaterial()) {
|
| + return rb.GetFontList(ui::ResourceBundle::SmallFont)
|
| + .Derive(1, style)
|
| + .GetPrimaryFont()
|
| + .GetNativeFont();
|
| + }
|
| + return rb.GetFontListWithDelta(-2, gfx::Font::NORMAL)
|
| .Derive(1, style)
|
| .GetPrimaryFont()
|
| .GetNativeFont();
|
|
|