diff options
author | avi@chromium.org <avi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-11 14:36:52 +0000 |
---|---|---|
committer | avi@chromium.org <avi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-11 14:36:52 +0000 |
commit | 7cd83d1caff7fa1090d9fc8eadb7474cb3b811f2 (patch) | |
tree | 7150d07291e245bdbefe440675f3f7243e1d4e1a /chrome/browser/browser_theme_provider_mac.mm | |
parent | 9b7d65f37d3392c5f69e44e053e9b3a3184b431d (diff) | |
download | chromium_src-7cd83d1caff7fa1090d9fc8eadb7474cb3b811f2.zip chromium_src-7cd83d1caff7fa1090d9fc8eadb7474cb3b811f2.tar.gz chromium_src-7cd83d1caff7fa1090d9fc8eadb7474cb3b811f2.tar.bz2 |
Allow theming of colors for the Mac.
BUG=http://crbug.com/18438
TEST=none
Review URL: http://codereview.chromium.org/162010
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@23023 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/browser_theme_provider_mac.mm')
-rw-r--r-- | chrome/browser/browser_theme_provider_mac.mm | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/chrome/browser/browser_theme_provider_mac.mm b/chrome/browser/browser_theme_provider_mac.mm index 059f24d..45bebc8 100644 --- a/chrome/browser/browser_theme_provider_mac.mm +++ b/chrome/browser/browser_theme_provider_mac.mm @@ -67,6 +67,33 @@ NSImage* BrowserThemeProvider::GetNSImageNamed(int id) { 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) + 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()); |