Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(471)

Side by Side Diff: chrome/browser/ui/cocoa/omnibox/omnibox_view_mac.mm

Issue 2013183003: [Mac][Material Design] Bring Omnibox stroke and MD colors up to spec. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/ui/cocoa/omnibox/omnibox_view_mac.h" 5 #include "chrome/browser/ui/cocoa/omnibox/omnibox_view_mac.h"
6 6
7 #include <Carbon/Carbon.h> // kVK_Return 7 #include <Carbon/Carbon.h> // kVK_Return
8 8
9 #include "base/mac/foundation_util.h" 9 #include "base/mac/foundation_util.h"
10 #include "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 if (!ui::MaterialDesignController::IsModeMaterial()) { 96 if (!ui::MaterialDesignController::IsModeMaterial()) {
97 return [NSColor blackColor]; 97 return [NSColor blackColor];
98 } 98 }
99 return in_dark_mode ? [NSColor whiteColor] : [NSColor blackColor]; 99 return in_dark_mode ? [NSColor whiteColor] : [NSColor blackColor];
100 } 100 }
101 NSColor* SecureSchemeColor(bool in_dark_mode) { 101 NSColor* SecureSchemeColor(bool in_dark_mode) {
102 if (!ui::MaterialDesignController::IsModeMaterial()) { 102 if (!ui::MaterialDesignController::IsModeMaterial()) {
103 return ColorWithRGBBytes(0x07, 0x95, 0x00); 103 return ColorWithRGBBytes(0x07, 0x95, 0x00);
104 } 104 }
105 return in_dark_mode ? [NSColor colorWithCalibratedWhite:1 alpha:0.5] 105 return in_dark_mode ? [NSColor colorWithCalibratedWhite:1 alpha:0.5]
106 : skia::SkColorToCalibratedNSColor(gfx::kGoogleGreen700); 106 : skia::SkColorToSRGBNSColor(gfx::kGoogleGreen700);
107 } 107 }
108 NSColor* SecurityWarningSchemeColor(bool in_dark_mode) { 108 NSColor* SecurityWarningSchemeColor(bool in_dark_mode) {
109 return in_dark_mode ? [NSColor colorWithCalibratedWhite:1 alpha:0.5] 109 return in_dark_mode ? [NSColor colorWithCalibratedWhite:1 alpha:0.5]
110 : skia::SkColorToCalibratedNSColor(gfx::kGoogleYellow700); 110 : skia::SkColorToSRGBNSColor(gfx::kGoogleYellow700);
111 } 111 }
112 NSColor* SecurityErrorSchemeColor(bool in_dark_mode) { 112 NSColor* SecurityErrorSchemeColor(bool in_dark_mode) {
113 if (!ui::MaterialDesignController::IsModeMaterial()) { 113 if (!ui::MaterialDesignController::IsModeMaterial()) {
114 return ColorWithRGBBytes(0xa2, 0x00, 0x00); 114 return ColorWithRGBBytes(0xa2, 0x00, 0x00);
115 } 115 }
116 return in_dark_mode ? [NSColor colorWithCalibratedWhite:1 alpha:0.5] 116 return in_dark_mode ? [NSColor colorWithCalibratedWhite:1 alpha:0.5]
117 : skia::SkColorToCalibratedNSColor(gfx::kGoogleRed700); 117 : skia::SkColorToSRGBNSColor(gfx::kGoogleRed700);
118 } 118 }
119 119
120 const char kOmniboxViewMacStateKey[] = "OmniboxViewMacState"; 120 const char kOmniboxViewMacStateKey[] = "OmniboxViewMacState";
121 121
122 // Store's the model and view state across tab switches. 122 // Store's the model and view state across tab switches.
123 struct OmniboxViewMacState : public base::SupportsUserData::Data { 123 struct OmniboxViewMacState : public base::SupportsUserData::Data {
124 OmniboxViewMacState(const OmniboxEditModel::State model_state, 124 OmniboxViewMacState(const OmniboxEditModel::State model_state,
125 const bool has_focus, 125 const bool has_focus,
126 const NSRange& selection) 126 const NSRange& selection)
127 : model_state(model_state), 127 : model_state(model_state),
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 SkColor OmniboxViewMac::BaseTextColorSkia(bool in_dark_mode) { 169 SkColor OmniboxViewMac::BaseTextColorSkia(bool in_dark_mode) {
170 return in_dark_mode ? SkColorSetA(SK_ColorWHITE, 0x7F) 170 return in_dark_mode ? SkColorSetA(SK_ColorWHITE, 0x7F)
171 : SkColorSetA(SK_ColorBLACK, 0x7F); 171 : SkColorSetA(SK_ColorBLACK, 0x7F);
172 } 172 }
173 173
174 // static 174 // static
175 NSColor* OmniboxViewMac::BaseTextColor(bool in_dark_mode) { 175 NSColor* OmniboxViewMac::BaseTextColor(bool in_dark_mode) {
176 if (!ui::MaterialDesignController::IsModeMaterial()) { 176 if (!ui::MaterialDesignController::IsModeMaterial()) {
177 return [NSColor darkGrayColor]; 177 return [NSColor darkGrayColor];
178 } 178 }
179 return skia::SkColorToCalibratedNSColor(BaseTextColorSkia(in_dark_mode)); 179 return skia::SkColorToSRGBNSColor(BaseTextColorSkia(in_dark_mode));
180 } 180 }
181 181
182 // static 182 // static
183 NSColor* OmniboxViewMac::GetSecureTextColor( 183 NSColor* OmniboxViewMac::GetSecureTextColor(
184 security_state::SecurityStateModel::SecurityLevel security_level, 184 security_state::SecurityStateModel::SecurityLevel security_level,
185 bool in_dark_mode) { 185 bool in_dark_mode) {
186 if (security_level == security_state::SecurityStateModel::EV_SECURE || 186 if (security_level == security_state::SecurityStateModel::EV_SECURE ||
187 security_level == security_state::SecurityStateModel::SECURE) { 187 security_level == security_state::SecurityStateModel::SECURE) {
188 return SecureSchemeColor(in_dark_mode); 188 return SecureSchemeColor(in_dark_mode);
189 } 189 }
(...skipping 971 matching lines...) Expand 10 before | Expand all | Expand 10 after
1161 display_text); 1161 display_text);
1162 NSDictionary* notification_info = @{ 1162 NSDictionary* notification_info = @{
1163 NSAccessibilityAnnouncementKey : announcement, 1163 NSAccessibilityAnnouncementKey : announcement,
1164 NSAccessibilityPriorityKey : @(NSAccessibilityPriorityHigh) 1164 NSAccessibilityPriorityKey : @(NSAccessibilityPriorityHigh)
1165 }; 1165 };
1166 NSAccessibilityPostNotificationWithUserInfo( 1166 NSAccessibilityPostNotificationWithUserInfo(
1167 [field_ window], 1167 [field_ window],
1168 NSAccessibilityAnnouncementRequestedNotification, 1168 NSAccessibilityAnnouncementRequestedNotification,
1169 notification_info); 1169 notification_info);
1170 } 1170 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698