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

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

Issue 1909453004: [Mac][Material Design] Adjust EV chip to match Material Design spec. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix problems. 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 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 NSImage* OmniboxViewMac::ImageForResource(int resource_id) { 152 NSImage* OmniboxViewMac::ImageForResource(int resource_id) {
153 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); 153 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
154 return rb.GetNativeImageNamed(resource_id).ToNSImage(); 154 return rb.GetNativeImageNamed(resource_id).ToNSImage();
155 } 155 }
156 156
157 // static 157 // static
158 NSColor* OmniboxViewMac::SuggestTextColor() { 158 NSColor* OmniboxViewMac::SuggestTextColor() {
159 return [NSColor colorWithCalibratedWhite:0.0 alpha:0.5]; 159 return [NSColor colorWithCalibratedWhite:0.0 alpha:0.5];
160 } 160 }
161 161
162 //static
163 SkColor OmniboxViewMac::SkBaseTextColor(bool in_dark_mode) {
164 // The returned colors should match BaseTextColor.
165 const SkColor kFiftyPercentWhite = 0x7FFFFFFF;
166 const SkColor kFiftyPercentBlack = 0x7F000000;
167 return in_dark_mode ? kFiftyPercentWhite
tapted 2016/04/27 02:37:39 what you have is fine, an alternative if you like
shrike 2016/04/27 16:35:17 I like your suggestion better (with 0x7F instead o
168 : kFiftyPercentBlack;
169 }
170
162 // static 171 // static
163 NSColor* OmniboxViewMac::BaseTextColor(bool inDarkMode) { 172 NSColor* OmniboxViewMac::BaseTextColor(bool in_dark_mode) {
164 if (!ui::MaterialDesignController::IsModeMaterial()) { 173 if (!ui::MaterialDesignController::IsModeMaterial()) {
165 return [NSColor darkGrayColor]; 174 return [NSColor darkGrayColor];
166 } 175 }
167 return inDarkMode ? [NSColor colorWithCalibratedWhite:1 alpha:0.5] 176 return skia::SkColorToCalibratedNSColor(SkBaseTextColor(in_dark_mode));
168 : [NSColor colorWithCalibratedWhite:0 alpha:0.5];
169 } 177 }
170 178
171 OmniboxViewMac::OmniboxViewMac(OmniboxEditController* controller, 179 OmniboxViewMac::OmniboxViewMac(OmniboxEditController* controller,
172 Profile* profile, 180 Profile* profile,
173 CommandUpdater* command_updater, 181 CommandUpdater* command_updater,
174 AutocompleteTextField* field) 182 AutocompleteTextField* field)
175 : OmniboxView( 183 : OmniboxView(
176 controller, 184 controller,
177 base::WrapUnique(new ChromeOmniboxClient(controller, profile))), 185 base::WrapUnique(new ChromeOmniboxClient(controller, profile))),
178 profile_(profile), 186 profile_(profile),
(...skipping 929 matching lines...) Expand 10 before | Expand all | Expand 10 after
1108 1116
1109 NSUInteger OmniboxViewMac::GetTextLength() const { 1117 NSUInteger OmniboxViewMac::GetTextLength() const {
1110 return [field_ currentEditor] ? [[[field_ currentEditor] string] length] : 1118 return [field_ currentEditor] ? [[[field_ currentEditor] string] length] :
1111 [[field_ stringValue] length]; 1119 [[field_ stringValue] length];
1112 } 1120 }
1113 1121
1114 bool OmniboxViewMac::IsCaretAtEnd() const { 1122 bool OmniboxViewMac::IsCaretAtEnd() const {
1115 const NSRange selection = GetSelectedRange(); 1123 const NSRange selection = GetSelectedRange();
1116 return NSMaxRange(selection) == GetTextLength(); 1124 return NSMaxRange(selection) == GetTextLength();
1117 } 1125 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698