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

Unified Diff: chrome/browser/browser_theme_provider_mac.mm

Issue 162010: Allow theming of colors for the Mac. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/browser_theme_provider.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/browser_theme_provider_mac.mm
===================================================================
--- chrome/browser/browser_theme_provider_mac.mm (revision 22474)
+++ chrome/browser/browser_theme_provider_mac.mm (working copy)
@@ -67,6 +67,33 @@
return empty_image;
}
+NSColor* BrowserThemeProvider::GetNSColor(int id) {
+ DCHECK(CalledOnValidThread());
+
+ // Check to see if we already have the color in the cache.
+ NSColorMap::const_iterator found = nscolor_cache_.find(id);
+ if (found != nscolor_cache_.end())
+ return found->second;
+
+ ColorMap::iterator color_iter = colors_.find(GetColorKey(id));
+ if (color_iter != colors_.end()) {
+ const SkColor& sk_color = color_iter->second;
+
+ NSColor* color = [NSColor colorWithCalibratedRed:SkColorGetR(sk_color)
Nico 2009/09/05 21:20:23 Come on guys. NSColor wants its channels in [0.0..
+ green:SkColorGetG(sk_color)
+ blue:SkColorGetB(sk_color)
+ alpha:SkColorGetA(sk_color)];
+
+ // We loaded successfully. Cache the color.
+ if (color) {
+ nscolor_cache_[id] = [color retain];
+ return color;
+ }
+ }
+
+ return nil;
+}
+
NSColor* BrowserThemeProvider::GetNSColorTint(int id) {
DCHECK(CalledOnValidThread());
« no previous file with comments | « chrome/browser/browser_theme_provider.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698