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

Unified Diff: chrome/browser/browser_theme_provider_mac.mm

Issue 151153: Allow getting the theme tint as a value so that it can be applied independent... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/browser_theme_provider_gtk.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 19729)
+++ chrome/browser/browser_theme_provider_mac.mm (working copy)
@@ -52,13 +52,50 @@
return empty_image;
}
-void BrowserThemeProvider::FreePlatformImages() {
+NSColor* BrowserThemeProvider::GetNSColorTint(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;
+
+ TintMap::iterator tint_iter = tints_.find(GetTintKey(id));
+ if (tint_iter != tints_.end()) {
+ skia::HSL tint = tint_iter->second;
+
+ // The tint is HSL, not HSB, but we're cheating for now. TODO(avi,alcor):
+ // determine how much this matters and fix it if necessary.
+ // http://crbug.com/15760
+ NSColor* tint_color = [NSColor colorWithCalibratedHue:tint.h
+ saturation:tint.s
+ brightness:tint.l
+ alpha:1.0];
+
+ // We loaded successfully. Cache the color.
+ if (tint_color) {
+ nscolor_cache_[id] = [tint_color retain];
+ return tint_color;
+ }
+ }
+
+ return nil;
+}
+
+void BrowserThemeProvider::FreePlatformCaches() {
+ DCHECK(CalledOnValidThread());
+
// Free images.
for (NSImageMap::iterator i = nsimage_cache_.begin();
i != nsimage_cache_.end(); i++) {
[i->second release];
}
nsimage_cache_.clear();
+
+ // Free colors.
+ for (NSColorMap::iterator i = nscolor_cache_.begin();
+ i != nscolor_cache_.end(); i++) {
+ [i->second release];
+ }
+ nscolor_cache_.clear();
}
« no previous file with comments | « chrome/browser/browser_theme_provider_gtk.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698