summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/app/theme/theme_resources.grd14
-rw-r--r--chrome/browser/ui/cocoa/image_button_cell.mm2
-rw-r--r--chrome/browser/ui/cocoa/tabs/tab_view.h3
-rw-r--r--chrome/browser/ui/cocoa/tabs/tab_view.mm80
4 files changed, 48 insertions, 51 deletions
diff --git a/chrome/app/theme/theme_resources.grd b/chrome/app/theme/theme_resources.grd
index b89e75f..e793e4e 100644
--- a/chrome/app/theme/theme_resources.grd
+++ b/chrome/app/theme/theme_resources.grd
@@ -793,7 +793,7 @@
<structure type="chrome_scaled_image" name="IDR_THEME_NTP_ATTRIBUTION" file="notused.png" />
<structure type="chrome_scaled_image" name="IDR_THEME_NTP_BACKGROUND" file="common/ntp_background.png" />
<structure type="chrome_scaled_image" name="IDR_THEME_NTP_BACKGROUND_WHITE" file="common/ntp_background_white.png" />
- <if expr="not pp_ifdef('use_ash')">
+ <if expr="not pp_ifdef('use_ash') and not is_macosx">
<structure type="chrome_scaled_image" name="IDR_THEME_TAB_BACKGROUND" file="theme_tab_background.png" />
<structure type="chrome_scaled_image" name="IDR_THEME_TAB_BACKGROUND_INCOGNITO" file="theme_tab_background_incognito.png" />
</if>
@@ -802,11 +802,11 @@
<structure type="chrome_scaled_image" name="IDR_THEME_TAB_BACKGROUND" file="cros/theme_default_inactive.png" />
<structure type="chrome_scaled_image" name="IDR_THEME_TAB_BACKGROUND_INCOGNITO" file="cros/theme_default_inactive.png" />
</if>
- <structure type="chrome_scaled_image" name="IDR_THEME_TAB_BACKGROUND_V" file="theme_tab_background_glass.png" />
- <if expr="not pp_ifdef('use_ash') and is_macosx">
- <!-- TODO(jamescook): Is this right? -->
- <structure type="chrome_scaled_image" name="IDR_THEME_TOOLBAR" file="theme_toolbar_default2.png" />
+ <if expr="is_macosx">
+ <structure type="chrome_scaled_image" name="IDR_THEME_TAB_BACKGROUND" file="mac/theme_default_inactive.png" />
+ <structure type="chrome_scaled_image" name="IDR_THEME_TAB_BACKGROUND_INACTIVE" file="mac/theme_default_inactive_background.png" />
</if>
+ <structure type="chrome_scaled_image" name="IDR_THEME_TAB_BACKGROUND_V" file="theme_tab_background_glass.png" />
<if expr="not pp_ifdef('use_ash') and not is_macosx">
<structure type="chrome_scaled_image" name="IDR_THEME_TOOLBAR" file="theme_toolbar_default.png" />
</if>
@@ -815,8 +815,8 @@
<structure type="chrome_scaled_image" name="IDR_THEME_TOOLBAR" file="cros/theme_default_active.png" />
</if>
<if expr="is_macosx">
- <!-- TODO(jamescook): Is this right? -->
- <structure type="chrome_scaled_image" name="IDR_THEME_TOOLBAR_INACTIVE" file="theme_toolbar_default_inactive2.png" />
+ <structure type="chrome_scaled_image" name="IDR_THEME_TOOLBAR" file="mac/theme_default_active.png" />
+ <structure type="chrome_scaled_image" name="IDR_THEME_TOOLBAR_INACTIVE" file="mac/theme_default_active_background.png" />
</if>
<!-- Instant Extended API toolbar background is common for all platforms. -->
<structure type="chrome_scaled_image" name="IDR_THEME_WINDOW_CONTROL_BACKGROUND" file="notused.png" />
diff --git a/chrome/browser/ui/cocoa/image_button_cell.mm b/chrome/browser/ui/cocoa/image_button_cell.mm
index a979014..1c71e7b 100644
--- a/chrome/browser/ui/cocoa/image_button_cell.mm
+++ b/chrome/browser/ui/cocoa/image_button_cell.mm
@@ -85,7 +85,7 @@ const CGFloat kImageNoFocusAlpha = 0.65;
[image drawInRect:imageRect
fromRect:NSZeroRect
operation:NSCompositeSourceOver
- fraction:alpha * 0.5
+ fraction:alpha * 0.3
respectFlipped:YES
hints:nil];
diff --git a/chrome/browser/ui/cocoa/tabs/tab_view.h b/chrome/browser/ui/cocoa/tabs/tab_view.h
index da5daed..518541b 100644
--- a/chrome/browser/ui/cocoa/tabs/tab_view.h
+++ b/chrome/browser/ui/cocoa/tabs/tab_view.h
@@ -9,7 +9,6 @@
#include <ApplicationServices/ApplicationServices.h>
#include "base/memory/scoped_nsobject.h"
-#import "chrome/browser/ui/cocoa/background_gradient_view.h"
#import "chrome/browser/ui/cocoa/hover_close_button.h"
namespace tabs {
@@ -38,7 +37,7 @@ enum AlertState {
// on the tab strip. Relies on an associated TabController to provide a
// target/action for selecting the tab.
-@interface TabView : BackgroundGradientView {
+@interface TabView : NSView {
@private
TabController* controller_;
// TODO(rohitrao): Add this button to a CoreAnimation layer so we can fade it
diff --git a/chrome/browser/ui/cocoa/tabs/tab_view.mm b/chrome/browser/ui/cocoa/tabs/tab_view.mm
index ecedd9a..c51ef83 100644
--- a/chrome/browser/ui/cocoa/tabs/tab_view.mm
+++ b/chrome/browser/ui/cocoa/tabs/tab_view.mm
@@ -68,7 +68,6 @@ const CGFloat kRapidCloseDist = 2.5;
closeButton:(HoverCloseButton*)closeButton {
self = [super initWithFrame:frame];
if (self) {
- [self setShowsDivider:NO];
controller_ = controller;
closeButton_ = closeButton;
}
@@ -258,44 +257,38 @@ const CGFloat kRapidCloseDist = 2.5;
NSRect rect = [self bounds];
NSBezierPath* path = [self bezierPathForRect:rect];
- BOOL active = [[self window] isKeyWindow] || [[self window] isMainWindow];
- BOOL selected = [self state];
+ int bitmapResources[2][2] = {
+ // Background window.
+ {
+ IDR_THEME_TAB_BACKGROUND_INACTIVE, // Background tab.
+ IDR_THEME_TOOLBAR_INACTIVE, // Active tab.
+ },
+ // Currently focused window.
+ {
+ IDR_THEME_TAB_BACKGROUND, // Background tab.
+ IDR_THEME_TOOLBAR, // Active tab.
+ },
+ };
+
+ bool selected = [self state];
+
+ NSColor* backgroundImageColor;
+ if (themeProvider) {
+ // Themes don't have an inactive image so only look for one if there's no
+ // theme.
+ bool active = [[self window] isKeyWindow] || [[self window] isMainWindow] ||
+ !themeProvider->UsingDefaultTheme();
+ backgroundImageColor = themeProvider->GetNSImageColorNamed(
+ bitmapResources[active][selected], true);
+ } else {
+ backgroundImageColor = [[self window] backgroundColor];
+ }
+
// Don't draw the window/tab bar background when selected, since the tab
// background overlay drawn over it (see below) will be fully opaque.
- BOOL hasBackgroundImage = NO;
if (!selected) {
- // ui::ThemeProvider::HasCustomImage is true only if the theme provides the
- // image. However, even if the theme doesn't provide a tab background, the
- // theme machinery will make one if given a frame image. See
- // BrowserThemePack::GenerateTabBackgroundImages for details.
- hasBackgroundImage = themeProvider &&
- (themeProvider->HasCustomImage(IDR_THEME_TAB_BACKGROUND) ||
- themeProvider->HasCustomImage(IDR_THEME_FRAME));
-
- NSColor* backgroundImageColor = hasBackgroundImage ?
- themeProvider->GetNSImageColorNamed(IDR_THEME_TAB_BACKGROUND, true) :
- nil;
-
- if (backgroundImageColor) {
- [backgroundImageColor set];
- [path fill];
- } else {
- CGFloat grey = active ? 0.8 : 0.9;
- scoped_nsobject<NSGradient> gradient([[NSGradient alloc]
- initWithStartingColor:[NSColor colorWithCalibratedWhite:grey alpha:1]
- endingColor:[NSColor colorWithCalibratedWhite:0.9 * grey alpha:1]]);
- [gradient drawInBezierPath:path angle:270];
-
- gfx::ScopedNSGraphicsContextSaveGState drawBackgroundState;
- NSGraphicsContext* context = [NSGraphicsContext currentContext];
- CGContextRef cgContext =
- static_cast<CGContextRef>([context graphicsPort]);
- CGContextBeginTransparencyLayer(cgContext, 0);
- CGContextSetAlpha(cgContext, 0.5);
- [path addClip];
- [super drawBackgroundWithOpaque:NO];
- CGContextEndTransparencyLayer(cgContext);
- }
+ [backgroundImageColor set];
+ [path fill];
}
// Use the same overlay for the selected state and for hover and alert
@@ -320,14 +313,19 @@ const CGFloat kRapidCloseDist = 2.5;
CGContextSetAlpha(cgContext, backgroundAlpha);
}
- {
- gfx::ScopedNSGraphicsContextSaveGState drawBackgroundState;
- [super drawBackgroundWithOpaque:NO];
- }
+ [backgroundImageColor set];
+ NSRectFill(dirtyRect);
+ // ui::ThemeProvider::HasCustomImage is true only if the theme provides the
+ // image. However, even if the theme doesn't provide a tab background, the
+ // 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_FRAME));
// Draw a mouse hover gradient for the default themes.
if (!selected && hoverAlpha > 0) {
- if (themeProvider && !hasBackgroundImage) {
+ if (themeProvider && !hasCustomTheme) {
scoped_nsobject<NSGradient> glow([NSGradient alloc]);
[glow initWithStartingColor:[NSColor colorWithCalibratedWhite:1.0
alpha:1.0 * hoverAlpha]