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

Side by Side Diff: chrome/browser/themes/theme_service_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: Fix compile error. Created 4 years, 6 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
« no previous file with comments | « no previous file | chrome/browser/ui/cocoa/location_bar/autocomplete_text_field.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/themes/theme_service.h" 5 #include "chrome/browser/themes/theme_service.h"
6 6
7 #import <Cocoa/Cocoa.h> 7 #import <Cocoa/Cocoa.h>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "chrome/browser/themes/browser_theme_pack.h" 10 #include "chrome/browser/themes/browser_theme_pack.h"
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 176
177 bool ThemeService::HasCustomColor(int id) const { 177 bool ThemeService::HasCustomColor(int id) const {
178 SkColor color; 178 SkColor color;
179 return theme_supplier_ && theme_supplier_->GetColor(id, &color); 179 return theme_supplier_ && theme_supplier_->GetColor(id, &color);
180 } 180 }
181 181
182 NSColor* ThemeService::GetNSColor(int id, bool incognito) const { 182 NSColor* ThemeService::GetNSColor(int id, bool incognito) const {
183 DCHECK(CalledOnValidThread()); 183 DCHECK(CalledOnValidThread());
184 184
185 int original_id = id; 185 int original_id = id;
186 if (ui::MaterialDesignController::IsModeMaterial() && incognito) { 186 const bool is_mode_material = ui::MaterialDesignController::IsModeMaterial();
187 if (is_mode_material && incognito) {
187 id += kMaterialDesignIdOffset; 188 id += kMaterialDesignIdOffset;
188 } 189 }
189 190
190 // Check to see if we already have the color in the cache. 191 // Check to see if we already have the color in the cache.
191 NSColorMap::const_iterator nscolor_iter = nscolor_cache_.find(id); 192 NSColorMap::const_iterator nscolor_iter = nscolor_cache_.find(id);
192 if (nscolor_iter != nscolor_cache_.end()) 193 if (nscolor_iter != nscolor_cache_.end())
193 return nscolor_iter->second; 194 return nscolor_iter->second;
194 195
195 SkColor sk_color = GetColor(original_id, incognito); 196 SkColor sk_color = GetColor(original_id, incognito);
196 NSColor* color = skia::SkColorToCalibratedNSColor(sk_color); 197 NSColor* color = nil;
198 if (is_mode_material) {
199 color = skia::SkColorToSRGBNSColor(sk_color);
200 } else {
201 color = skia::SkColorToCalibratedNSColor(sk_color);
202 }
197 203
198 // We loaded successfully. Cache the color. 204 // We loaded successfully. Cache the color.
199 if (color) 205 if (color)
200 nscolor_cache_[id] = [color retain]; 206 nscolor_cache_[id] = [color retain];
201 207
202 return color; 208 return color;
203 } 209 }
204 210
205 NSColor* ThemeService::GetNSColorTint(int id) const { 211 NSColor* ThemeService::GetNSColorTint(int id) const {
206 DCHECK(CalledOnValidThread()); 212 DCHECK(CalledOnValidThread());
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
392 return theme_service_.GetNSColor(id, incognito_); 398 return theme_service_.GetNSColor(id, incognito_);
393 } 399 }
394 400
395 NSColor* ThemeService::BrowserThemeProvider::GetNSColorTint(int id) const { 401 NSColor* ThemeService::BrowserThemeProvider::GetNSColorTint(int id) const {
396 return theme_service_.GetNSColorTint(id); 402 return theme_service_.GetNSColorTint(id);
397 } 403 }
398 404
399 NSGradient* ThemeService::BrowserThemeProvider::GetNSGradient(int id) const { 405 NSGradient* ThemeService::BrowserThemeProvider::GetNSGradient(int id) const {
400 return theme_service_.GetNSGradient(id); 406 return theme_service_.GetNSGradient(id);
401 } 407 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/cocoa/location_bar/autocomplete_text_field.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698