Chromium Code Reviews| Index: chrome/browser/cocoa/tab_window_controller.mm |
| diff --git a/chrome/browser/cocoa/tab_window_controller.mm b/chrome/browser/cocoa/tab_window_controller.mm |
| index c1701f1fabc21a0553e6fd96ab9be67df494e77d..1356a792830881756b55bee782f5772f218e6d1f 100644 |
| --- a/chrome/browser/cocoa/tab_window_controller.mm |
| +++ b/chrome/browser/cocoa/tab_window_controller.mm |
| @@ -13,6 +13,37 @@ |
| - (void)setUseOverlay:(BOOL)useOverlay; |
| @end |
| +@interface PopupStripView : NSView { |
| + @protected |
|
viettrungluu
2010/08/20 17:02:00
why protected and not private?
|
| + TabWindowController* controller_; // weak: own us. |
|
viettrungluu
2010/08/20 17:02:00
s/own/owns/
|
| +} |
| + |
| +- (void)setController:(TabWindowController*)controller; |
|
viettrungluu
2010/08/20 17:02:00
Just declare it as a @property; in general, things
|
| +@end |
| + |
| +@implementation PopupStripView |
| +- (id)initWithFrame:(NSRect)frameRect { |
| + if ((self = [super initWithFrame:frameRect]) != nil) { |
| + controller_ = nil; |
| + } |
| + return self; |
| +} |
| + |
| +- (BOOL)acceptsFirstMouse:(NSEvent*)event { |
| + return YES; |
| +} |
| + |
| +- (NSMenu *)menuForEvent:(NSEvent*)event { |
| + if (!controller_) |
| + return nil; |
| + return [controller_ popupContextMenu]; |
| +} |
| + |
| +- (void)setController:(TabWindowController*)controller { |
| + controller_ = controller; |
| +} |
| +@end |
| + |
| @interface TabWindowOverlayWindow : NSWindow |
| @end |
| @@ -75,6 +106,21 @@ |
| [contentParent addSubview:topTabStripView_]; |
| } |
| +- (void)addPopupStripToWindow { |
| + NSRect contentFrame = [[[self window] contentView] frame]; |
|
viettrungluu
2010/08/20 17:02:00
Please do |NSView* contentView = [[self window] co
|
| + NSRect outerFrame = [[[[self window] contentView] superview] frame]; |
| + NSRect stripFrame = |
| + NSMakeRect(0, |
| + NSMaxY(contentFrame), |
| + NSWidth(contentFrame), |
| + NSHeight(outerFrame) - NSHeight(contentFrame)); |
| + [popupStripView_ setFrame:stripFrame]; |
| + [popupStripView_ setController:self]; |
| + |
| + NSView* contentParent = [[[self window] contentView] superview]; |
|
viettrungluu
2010/08/20 17:02:00
You can probably now do |[[contentView superview]
|
| + [contentParent addSubview:popupStripView_]; |
| +} |
| + |
| - (void)windowDidLoad { |
| // Cache the difference in height between the window content area and the |
| // tab content area. |
| @@ -95,6 +141,7 @@ |
| // No top tabstrip so remove the tabContentArea offset. |
| tabFrame.size.height = contentFrame.size.height; |
| [tabContentArea_ setFrame:tabFrame]; |
| + [self addPopupStripToWindow]; |
| } |
| } |
| @@ -339,4 +386,7 @@ |
| NOTIMPLEMENTED(); |
| } |
| +- (NSMenu*)popupContextMenu { |
| + return nil; // Doesn't show a context menu at the default. |
|
viettrungluu
2010/08/20 17:02:00
s/at the/by/
|
| +} |
| @end |