Index: chrome/browser/ui/cocoa/extensions/shell_window_cocoa.mm |
diff --git a/chrome/browser/ui/cocoa/extensions/shell_window_cocoa.mm b/chrome/browser/ui/cocoa/extensions/shell_window_cocoa.mm |
index 479114c31a81bbb470f150af05ffa3fdd2f05708..e32d6a84901f728930009afb017d97d09aa291a4 100644 |
--- a/chrome/browser/ui/cocoa/extensions/shell_window_cocoa.mm |
+++ b/chrome/browser/ui/cocoa/extensions/shell_window_cocoa.mm |
@@ -72,6 +72,21 @@ |
@end |
+@interface ControlRegionView : NSView |
+@end |
+@implementation ControlRegionView |
+- (BOOL)mouseDownCanMoveWindow { |
+ return NO; |
+} |
+- (NSView*)hitTest:(NSPoint)aPoint { |
+ return nil; |
+} |
+@end |
+ |
+@interface NSView (WebContentsView) |
+- (void)setMouseDownCanMoveWindow:(BOOL)can_move; |
+@end |
+ |
ShellWindowCocoa::ShellWindowCocoa(Profile* profile, |
const extensions::Extension* extension, |
const GURL& url, |
@@ -108,9 +123,33 @@ ShellWindowCocoa::ShellWindowCocoa(Profile* profile, |
[window setBottomCornerRounded:NO]; |
NSView* view = web_contents()->GetView()->GetNativeView(); |
- [view setFrame:[[window contentView] bounds]]; |
[view setAutoresizingMask:NSViewWidthSizable | NSViewHeightSizable]; |
- [[window contentView] addSubview:view]; |
+ if (params.frame == ShellWindow::CreateParams::FRAME_CHROME) { |
+ [view setFrame:[[window contentView] bounds]]; |
+ [[window contentView] addSubview:view]; |
+ } else { |
+ NSView* web_contents_view = |
+ web_contents()->GetView()->GetNativeView(); |
+ DCHECK([web_contents_view |
+ respondsToSelector:@selector(setMouseDownCanMoveWindow:)]); |
+ [web_contents_view setMouseDownCanMoveWindow:YES]; |
+ NSView* frameView = [[window contentView] superview]; |
+ [view setFrame:[frameView bounds]]; |
+ [frameView addSubview:view]; |
+ [[window standardWindowButton:NSWindowZoomButton] setHidden:YES]; |
+ [[window standardWindowButton:NSWindowMiniaturizeButton] setHidden:YES]; |
+ [[window standardWindowButton:NSWindowCloseButton] setHidden:YES]; |
+ |
+ // TODO(jeremya): this is a temporary hack to allow moving the window while |
+ // we still don't have proper draggable region support. |
+ NSView* controlRegion = [[ControlRegionView alloc] init]; |
+ [controlRegion setFrame:NSMakeRect(0, 0, NSWidth([frameView bounds]), |
+ NSHeight([frameView bounds]) - 20)]; |
+ [controlRegion setAutoresizingMask: |
+ NSViewWidthSizable | NSViewHeightSizable]; |
+ [frameView addSubview:controlRegion]; |
+ [controlRegion release]; |
+ } |
window_controller_.reset( |
[[ShellWindowController alloc] initWithWindow:window.release()]); |