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

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

Issue 7130001: Make infobar background gray (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: '' Created 9 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 | Annotate | Revision Log
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"
11 #include "skia/ext/skia_utils_mac.h" 11 #include "skia/ext/skia_utils_mac.h"
12 #import "third_party/GTM/AppKit/GTMNSColor+Luminance.h" 12 #import "third_party/GTM/AppKit/GTMNSColor+Luminance.h"
13 #include "ui/base/resource/resource_bundle.h" 13 #include "ui/base/resource/resource_bundle.h"
14 #include "ui/gfx/color_utils.h" 14 #include "ui/gfx/color_utils.h"
15 #include "ui/gfx/image.h" 15 #include "ui/gfx/image.h"
16 #include "skia/ext/skia_utils_mac.h"
16 17
17 NSString* const kBrowserThemeDidChangeNotification = 18 NSString* const kBrowserThemeDidChangeNotification =
18 @"BrowserThemeDidChangeNotification"; 19 @"BrowserThemeDidChangeNotification";
19 20
20 namespace { 21 namespace {
21 22
22 void HSLToHSB(const color_utils::HSL& hsl, CGFloat* h, CGFloat* s, CGFloat* b) { 23 void HSLToHSB(const color_utils::HSL& hsl, CGFloat* h, CGFloat* s, CGFloat* b) {
23 SkColor color = color_utils::HSLToSkColor(hsl, 255); // alpha doesn't matter 24 SkColor color = color_utils::HSLToSkColor(hsl, 255); // alpha doesn't matter
24 SkScalar hsv[3]; 25 SkScalar hsv[3];
25 SkColorToHSV(color, hsv); 26 SkColorToHSV(color, hsv);
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 if (theme_pack_.get() && theme_pack_->GetColor(id, &sk_color)) { 126 if (theme_pack_.get() && theme_pack_->GetColor(id, &sk_color)) {
126 is_default = false; 127 is_default = false;
127 } else { 128 } else {
128 is_default = true; 129 is_default = true;
129 sk_color = GetDefaultColor(id); 130 sk_color = GetDefaultColor(id);
130 } 131 }
131 132
132 if (is_default && !allow_default) 133 if (is_default && !allow_default)
133 return nil; 134 return nil;
134 135
135 NSColor* color = [NSColor 136 NSColor* color = gfx::SkColorToCalibratedNSColor(sk_color);
136 colorWithCalibratedRed:SkColorGetR(sk_color)/255.0
137 green:SkColorGetG(sk_color)/255.0
138 blue:SkColorGetB(sk_color)/255.0
139 alpha:SkColorGetA(sk_color)/255.0];
140 137
141 // We loaded successfully. Cache the color. 138 // We loaded successfully. Cache the color.
142 if (color) 139 if (color)
143 nscolor_cache_[id] = std::make_pair([color retain], is_default); 140 nscolor_cache_[id] = std::make_pair([color retain], is_default);
144 141
145 return color; 142 return color;
146 } 143 }
147 144
148 NSColor* ThemeService::GetNSColorTint(int id, bool allow_default) const { 145 NSColor* ThemeService::GetNSColorTint(int id, bool allow_default) const {
149 DCHECK(CalledOnValidThread()); 146 DCHECK(CalledOnValidThread());
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
316 } 313 }
317 nscolor_cache_.clear(); 314 nscolor_cache_.clear();
318 315
319 // Free gradients. 316 // Free gradients.
320 for (NSGradientMap::iterator i = nsgradient_cache_.begin(); 317 for (NSGradientMap::iterator i = nsgradient_cache_.begin();
321 i != nsgradient_cache_.end(); i++) { 318 i != nsgradient_cache_.end(); i++) {
322 [i->second release]; 319 [i->second release];
323 } 320 }
324 nsgradient_cache_.clear(); 321 nsgradient_cache_.clear();
325 } 322 }
OLDNEW
« no previous file with comments | « chrome/browser/tab_contents/infobar.cc ('k') | chrome/browser/ui/cocoa/infobars/infobar_controller.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698