diff options
Diffstat (limited to 'chrome/browser/cocoa')
-rw-r--r-- | chrome/browser/cocoa/tab_controller.mm | 13 | ||||
-rw-r--r-- | chrome/browser/cocoa/tab_view.h | 8 | ||||
-rw-r--r-- | chrome/browser/cocoa/tab_view.mm | 13 |
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 { |