Chromium Code Reviews| Index: chrome/browser/ui/cocoa/tabs/tab_view.mm |
| diff --git a/chrome/browser/ui/cocoa/tabs/tab_view.mm b/chrome/browser/ui/cocoa/tabs/tab_view.mm |
| index e4271e259f3474d02f46c9478764ecfd08b7377b..f24755f562041b6339de88c66dca0f866ee8963b 100644 |
| --- a/chrome/browser/ui/cocoa/tabs/tab_view.mm |
| +++ b/chrome/browser/ui/cocoa/tabs/tab_view.mm |
| @@ -302,6 +302,12 @@ const CGFloat kRapidCloseDist = 2.5; |
| // Draws the active tab background. |
| - (void)drawFillForActiveTab:(NSRect)dirtyRect { |
| + gfx::ScopedNSGraphicsContextSaveGState scopedGState; |
| + NSGraphicsContext* context = [NSGraphicsContext currentContext]; |
| + NSPoint position = [[self window] |
| + themeImagePositionForAlignment: THEME_IMAGE_ALIGN_WITH_TAB_STRIP]; |
|
sail
2013/08/22 18:23:01
no space after colon
|
| + [context cr_setPatternPhase:position forView:self]; |
| + |
| NSColor* backgroundImageColor = [self backgroundColorForSelected:YES]; |
| [backgroundImageColor set]; |
| @@ -323,9 +329,6 @@ const CGFloat kRapidCloseDist = 2.5; |
| ThemeService* themeProvider = |
| static_cast<ThemeService*>([[self window] themeProvider]); |
| - NSPoint position = [[self window] |
| - themeImagePositionForAlignment: THEME_IMAGE_ALIGN_WITH_TAB_STRIP]; |
| - [context cr_setPatternPhase:position forView:self]; |
| CGImageRef mask([self tabClippingMask]); |
| CGRect maskBounds = CGRectMake(0, 0, maskCacheWidth_, kMaskHeight); |
| @@ -342,7 +345,10 @@ const CGFloat kRapidCloseDist = 2.5; |
| if (dirtyRect.origin.y < 1) |
| dirtyRect.origin.y = 2 * [self cr_lineWidth]; |
| - // Draw the tab background. |
| + // Draw the tinted frame image. |
| + NSPoint position = [[self window] |
| + themeImagePositionForAlignment: THEME_IMAGE_ALIGN_WITH_FRAME]; |
|
sail
2013/08/22 18:23:01
no space after colon
|
| + [context cr_setPatternPhase:position forView:self]; |
| NSColor* backgroundImageColor = [self backgroundColorForSelected:NO]; |
| [backgroundImageColor set]; |
| @@ -354,6 +360,22 @@ const CGFloat kRapidCloseDist = 2.5; |
| else |
| NSRectFillUsingOperation(dirtyRect, NSCompositeSourceOver); |
| + // If the theme is not the default theme, it may provide a custom overlay |
| + // image. The overlay image is aligned with the top of the tab. |
| + NSColor* overlayImageColor = nil; |
| + if (themeProvider && |
| + themeProvider->HasCustomImage(IDR_THEME_TAB_BACKGROUND_OVERLAY)) { |
| + overlayImageColor = themeProvider->GetNSImageColorNamed( |
| + IDR_THEME_TAB_BACKGROUND_OVERLAY); |
| + } |
| + if (overlayImageColor) { |
| + position = [[self window] |
| + themeImagePositionForAlignment: THEME_IMAGE_ALIGN_WITH_TAB_STRIP]; |
|
sail
2013/08/22 18:23:01
no space after colon
|
| + [context cr_setPatternPhase:position forView:self]; |
| + [overlayImageColor set]; |
| + NSRectFillUsingOperation(dirtyRect, NSCompositeSourceOver); |
| + } |
| + |
| // Draw the glow for hover and the overlay for alerts. |
| CGFloat hoverAlpha = [self hoverAlpha]; |
| CGFloat alertAlpha = [self alertAlpha]; |
| @@ -374,7 +396,7 @@ const CGFloat kRapidCloseDist = 2.5; |
| // theme machinery will make one if given a frame image. See |
| // BrowserThemePack::GenerateTabBackgroundImages for details. |
| BOOL hasCustomTheme = themeProvider && |
| - (themeProvider->HasCustomImage(IDR_THEME_TAB_BACKGROUND) || |
| + (themeProvider->HasCustomImage(IDR_THEME_TAB_BACKGROUND_OVERLAY) || |
| themeProvider->HasCustomImage(IDR_THEME_FRAME)); |
| // Draw a mouse hover gradient for the default themes. |
| if (hoverAlpha > 0) { |