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

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

Issue 1492423003: Rejigger ThemeService: move exposure of ThemeProvider interface to a (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix that unittest Created 5 years 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) 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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 } 105 }
106 106
107 NSColor* ThemeService::GetNSColor(int id) const { 107 NSColor* ThemeService::GetNSColor(int id) const {
108 DCHECK(CalledOnValidThread()); 108 DCHECK(CalledOnValidThread());
109 109
110 // Check to see if we already have the color in the cache. 110 // Check to see if we already have the color in the cache.
111 NSColorMap::const_iterator nscolor_iter = nscolor_cache_.find(id); 111 NSColorMap::const_iterator nscolor_iter = nscolor_cache_.find(id);
112 if (nscolor_iter != nscolor_cache_.end()) 112 if (nscolor_iter != nscolor_cache_.end())
113 return nscolor_iter->second; 113 return nscolor_iter->second;
114 114
115 SkColor sk_color = GetColor(id); 115 SkColor sk_color = GetColor(id, false);
116 NSColor* color = skia::SkColorToCalibratedNSColor(sk_color); 116 NSColor* color = skia::SkColorToCalibratedNSColor(sk_color);
117 117
118 // We loaded successfully. Cache the color. 118 // We loaded successfully. Cache the color.
119 if (color) 119 if (color)
120 nscolor_cache_[id] = [color retain]; 120 nscolor_cache_[id] = [color retain];
121 121
122 return color; 122 return color;
123 } 123 }
124 124
125 NSColor* ThemeService::GetNSColorTint(int id) const { 125 NSColor* ThemeService::GetNSColorTint(int id) const {
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 } 279 }
280 nscolor_cache_.clear(); 280 nscolor_cache_.clear();
281 281
282 // Free gradients. 282 // Free gradients.
283 for (NSGradientMap::iterator i = nsgradient_cache_.begin(); 283 for (NSGradientMap::iterator i = nsgradient_cache_.begin();
284 i != nsgradient_cache_.end(); i++) { 284 i != nsgradient_cache_.end(); i++) {
285 [i->second release]; 285 [i->second release];
286 } 286 }
287 nsgradient_cache_.clear(); 287 nsgradient_cache_.clear();
288 } 288 }
289
290 bool ThemeService::BrowserThemeProvider::UsingSystemTheme() const {
291 return theme_service_.UsingSystemTheme();
292 }
293
294 NSImage* ThemeService::BrowserThemeProvider::GetNSImageNamed(int id) const {
295 return theme_service_.GetNSImageNamed(id);
296 }
297
298 NSColor* ThemeService::BrowserThemeProvider::GetNSImageColorNamed(
299 int id) const {
300 return theme_service_.GetNSImageColorNamed(id);
301 }
302
303 NSColor* ThemeService::BrowserThemeProvider::GetNSColor(int id) const {
304 return theme_service_.GetNSColor(id);
305 }
306
307 NSColor* ThemeService::BrowserThemeProvider::GetNSColorTint(int id) const {
308 return theme_service_.GetNSColorTint(id);
309 }
310
311 NSGradient* ThemeService::BrowserThemeProvider::GetNSGradient(int id) const {
312 return theme_service_.GetNSGradient(id);
313 }
OLDNEW
« no previous file with comments | « chrome/browser/themes/theme_service_browsertest.cc ('k') | chrome/browser/themes/theme_service_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698