summaryrefslogtreecommitdiffstats
path: root/chrome/browser
diff options
context:
space:
mode:
authoravi@chromium.org <avi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-16 14:13:35 +0000
committeravi@chromium.org <avi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-16 14:13:35 +0000
commit0564b9a64eae26351f40e00fb68d47e398141f92 (patch)
tree77d4bd01b549b0e0e32f55727f287618a09e7e0a /chrome/browser
parent61dd4fcdbb69e8fa9b93f6b6a9d571ee5dd135ea (diff)
downloadchromium_src-0564b9a64eae26351f40e00fb68d47e398141f92.zip
chromium_src-0564b9a64eae26351f40e00fb68d47e398141f92.tar.gz
chromium_src-0564b9a64eae26351f40e00fb68d47e398141f92.tar.bz2
Fix Mac theme provider so it returns nil when there is no theme provided color. Partial revert of r28560.
BUG=http://crbug.com/24551 TEST=as in bug Review URL: http://codereview.chromium.org/274069 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@29269 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r--chrome/browser/browser_theme_provider_mac.mm25
-rw-r--r--chrome/browser/cocoa/bookmark_bar_toolbar_view.mm23
2 files changed, 29 insertions, 19 deletions
diff --git a/chrome/browser/browser_theme_provider_mac.mm b/chrome/browser/browser_theme_provider_mac.mm
index 1b88aed..65c2182 100644
--- a/chrome/browser/browser_theme_provider_mac.mm
+++ b/chrome/browser/browser_theme_provider_mac.mm
@@ -75,17 +75,20 @@ NSColor* BrowserThemeProvider::GetNSColor(int id) const {
if (nscolor_iter != nscolor_cache_.end())
return nscolor_iter->second;
- SkColor sk_color = GetColor(id);
- NSColor* color = [NSColor
- colorWithCalibratedRed:SkColorGetR(sk_color)/255.0
- green:SkColorGetG(sk_color)/255.0
- blue:SkColorGetB(sk_color)/255.0
- alpha:SkColorGetA(sk_color)/255.0];
-
- // We loaded successfully. Cache the color.
- if (color) {
- nscolor_cache_[id] = [color retain];
- return color;
+ ColorMap::const_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)/255.0
+ green:SkColorGetG(sk_color)/255.0
+ blue:SkColorGetB(sk_color)/255.0
+ alpha:SkColorGetA(sk_color)/255.0];
+
+ // We loaded successfully. Cache the color.
+ if (color) {
+ nscolor_cache_[id] = [color retain];
+ return color;
+ }
}
return nil;
diff --git a/chrome/browser/cocoa/bookmark_bar_toolbar_view.mm b/chrome/browser/cocoa/bookmark_bar_toolbar_view.mm
index 433f30f..56fb632 100644
--- a/chrome/browser/cocoa/bookmark_bar_toolbar_view.mm
+++ b/chrome/browser/cocoa/bookmark_bar_toolbar_view.mm
@@ -54,11 +54,6 @@ const CGFloat kBorderRadius = 3.0;
}
}
-@end
-
-
-@implementation BookmarkBarToolbarView (Private)
-
- (void)drawRectAsFloating:(NSRect)rect {
NSRect bounds = [self bounds];
@@ -86,15 +81,27 @@ const CGFloat kBorderRadius = 3.0;
bookmarks::kNTPBookmarkBarPadding,
NSWidth(bounds) - 2 * bookmarks::kNTPBookmarkBarPadding,
NSHeight(bounds) - 2 * bookmarks::kNTPBookmarkBarPadding);
- // Now draw a beizer path with rounded rectangles around the area
+ // Now draw a bezier path with rounded rectangles around the area
NSBezierPath* border =
[NSBezierPath bezierPathWithRoundedRect:frame_rect
xRadius:kBorderRadius
yRadius:kBorderRadius];
- [themeProvider->GetNSColor(BrowserThemeProvider::COLOR_TOOLBAR) set];;
+ NSColor* toolbarColor =
+ [[self gtm_theme] backgroundColorForStyle:GTMThemeStyleToolBar
+ state:GTMThemeStateActiveWindow];
+ // workaround for default theme
+ // TODO(alcor) next GTM update return nil for background color if not set;
+ if ([toolbarColor isEqual:[NSColor colorWithCalibratedWhite:0.5 alpha:1.0]])
+ toolbarColor = nil;
+ if (!toolbarColor)
+ toolbarColor = [NSColor colorWithCalibratedWhite:0.9 alpha:1.0];
+ [toolbarColor set];
[border fill];
- [themeProvider->GetNSColor(BrowserThemeProvider::COLOR_NTP_HEADER) set];
+ NSColor* borderColor =
+ [[self gtm_theme] strokeColorForStyle:GTMThemeStyleToolBar
+ state:GTMThemeStateActiveWindow];
+ [borderColor set];
[border stroke];
[theContext restoreGraphicsState];