summaryrefslogtreecommitdiffstats
path: root/chrome/browser/cocoa
diff options
context:
space:
mode:
authorrsesek@chromium.org <rsesek@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-09 15:33:43 +0000
committerrsesek@chromium.org <rsesek@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-09 15:33:43 +0000
commit1224685915d0687e3dad2e855161693da41122c5 (patch)
treed81b0d15fe62770b8b98a95df39721beb82d9219 /chrome/browser/cocoa
parentbd14784bcadf8cf55ae92e713a2545245bb02826 (diff)
downloadchromium_src-1224685915d0687e3dad2e855161693da41122c5.zip
chromium_src-1224685915d0687e3dad2e855161693da41122c5.tar.gz
chromium_src-1224685915d0687e3dad2e855161693da41122c5.tar.bz2
Re-land r43741 - broke browser_tests.
[Mac] Make Mac phantom tabs match the appearance of the other platforms. BUG=none TEST=Open a new tab, navigate, and pin it. Open a new tab. Close the pinned tab. No tab background should be drawn, just the favicon. Review URL: http://codereview.chromium.org/1632007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@44085 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/cocoa')
-rw-r--r--chrome/browser/cocoa/tab_controller.mm13
-rw-r--r--chrome/browser/cocoa/tab_view.h8
-rw-r--r--chrome/browser/cocoa/tab_view.mm13
3 files changed, 22 insertions, 12 deletions
diff --git a/chrome/browser/cocoa/tab_controller.mm b/chrome/browser/cocoa/tab_controller.mm
index 8058935..cb997d0 100644
--- a/chrome/browser/cocoa/tab_controller.mm
+++ b/chrome/browser/cocoa/tab_controller.mm
@@ -20,13 +20,6 @@
@synthesize target = target_;
@synthesize action = action_;
-namespace {
-
-// If the tab is phantom, the opacity of the TabView is adjusted to this value.
-const CGFloat kPhantomTabAlpha = 105.0 / 255.0;
-
-}; // anonymous namespace
-
namespace TabControllerInternal {
// A C++ delegate that handles enabling/disabling menu items and handling when
@@ -105,6 +98,7 @@ class MenuDelegate : public menus::SimpleMenuModel::Delegate {
- (void)dealloc {
[[NSNotificationCenter defaultCenter] removeObserver:self];
+ [[self tabView] setController:nil];
[super dealloc];
}
@@ -246,11 +240,6 @@ class MenuDelegate : public menus::SimpleMenuModel::Delegate {
// If the tab is a mini-tab, hide the title.
[titleView_ setHidden:[self mini]];
- // If it's a phantom mini-tab, draw it alpha-style. Windows does this.
- CGFloat alphaValue = [self phantom] ? kPhantomTabAlpha
- : 1.0;
- [[self view] setAlphaValue:alphaValue];
-
BOOL oldShowCloseButton = [closeButton_ isHidden] ? NO : YES;
BOOL newShowCloseButton = [self shouldShowCloseButton] ? YES : NO;
diff --git a/chrome/browser/cocoa/tab_view.h b/chrome/browser/cocoa/tab_view.h
index b43053e..0e1149f 100644
--- a/chrome/browser/cocoa/tab_view.h
+++ b/chrome/browser/cocoa/tab_view.h
@@ -109,4 +109,12 @@ enum AlertState {
@end
+// The TabController |controller_| is not the only owner of this view. If the
+// controller is released before this view, then we could be hanging onto a
+// garbage pointer. To prevent this, the TabController uses this interface to
+// clear the |controller_| pointer when it is dying.
+@interface TabView (TabControllerInterface)
+- (void)setController:(TabController*)controller;
+@end
+
#endif // CHROME_BROWSER_COCOA_TAB_VIEW_H_
diff --git a/chrome/browser/cocoa/tab_view.mm b/chrome/browser/cocoa/tab_view.mm
index b403f74..8873727 100644
--- a/chrome/browser/cocoa/tab_view.mm
+++ b/chrome/browser/cocoa/tab_view.mm
@@ -599,6 +599,11 @@ const CGFloat kRapidCloseDist = 2.5;
}
- (void)drawRect:(NSRect)rect {
+ // If this tab is phantom, do not draw the tab background itself. The only UI
+ // element that will represent this tab is the favicon.
+ if ([controller_ phantom])
+ return;
+
NSGraphicsContext* context = [NSGraphicsContext currentContext];
[context saveGraphicsState];
rect = [self bounds];
@@ -863,6 +868,14 @@ const CGFloat kRapidCloseDist = 2.5;
@end // @implementation TabView
+@implementation TabView (TabControllerInterface)
+
+- (void)setController:(TabController*)controller {
+ controller_ = controller;
+}
+
+@end // @implementation TabView (TabControllerInterface)
+
@implementation TabView(Private)
- (void)resetLastGlowUpdateTime {