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

Side by Side Diff: chrome/browser/themes/theme_service_mac.mm

Issue 2035153002: Revert of [Mac][Material Design] Bring Omnibox stroke and MD colors up to spec. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2743
Patch Set: 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 const bool is_mode_material = ui::MaterialDesignController::IsModeMaterial(); 186 if (ui::MaterialDesignController::IsModeMaterial() && incognito) {
187 if (is_mode_material && incognito) {
188 id += kMaterialDesignIdOffset; 187 id += kMaterialDesignIdOffset;
189 } 188 }
190 189
191 // Check to see if we already have the color in the cache. 190 // Check to see if we already have the color in the cache.
192 NSColorMap::const_iterator nscolor_iter = nscolor_cache_.find(id); 191 NSColorMap::const_iterator nscolor_iter = nscolor_cache_.find(id);
193 if (nscolor_iter != nscolor_cache_.end()) 192 if (nscolor_iter != nscolor_cache_.end())
194 return nscolor_iter->second; 193 return nscolor_iter->second;
195 194
196 SkColor sk_color = GetColor(original_id, incognito); 195 SkColor sk_color = GetColor(original_id, incognito);
197 NSColor* color = nil; 196 NSColor* color = skia::SkColorToCalibratedNSColor(sk_color);
198 if (is_mode_material) {
199 color = skia::SkColorToSRGBNSColor(sk_color);
200 } else {
201 color = skia::SkColorToCalibratedNSColor(sk_color);
202 }
203 197
204 // We loaded successfully. Cache the color. 198 // We loaded successfully. Cache the color.
205 if (color) 199 if (color)
206 nscolor_cache_[id] = [color retain]; 200 nscolor_cache_[id] = [color retain];
207 201
208 return color; 202 return color;
209 } 203 }
210 204
211 NSColor* ThemeService::GetNSColorTint(int id) const { 205 NSColor* ThemeService::GetNSColorTint(int id) const {
212 DCHECK(CalledOnValidThread()); 206 DCHECK(CalledOnValidThread());
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
398 return theme_service_.GetNSColor(id, incognito_); 392 return theme_service_.GetNSColor(id, incognito_);
399 } 393 }
400 394
401 NSColor* ThemeService::BrowserThemeProvider::GetNSColorTint(int id) const { 395 NSColor* ThemeService::BrowserThemeProvider::GetNSColorTint(int id) const {
402 return theme_service_.GetNSColorTint(id); 396 return theme_service_.GetNSColorTint(id);
403 } 397 }
404 398
405 NSGradient* ThemeService::BrowserThemeProvider::GetNSGradient(int id) const { 399 NSGradient* ThemeService::BrowserThemeProvider::GetNSGradient(int id) const {
406 return theme_service_.GetNSGradient(id); 400 return theme_service_.GetNSGradient(id);
407 } 401 }
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