diff options
-rw-r--r-- | chrome/browser/browser_theme_provider_mac.mm | 25 | ||||
-rw-r--r-- | chrome/browser/cocoa/bookmark_bar_toolbar_view.mm | 23 |
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]; |