| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/ui/cocoa/extensions/shell_window_cocoa.h" | 5 #include "chrome/browser/ui/cocoa/extensions/shell_window_cocoa.h" |
| 6 | 6 |
| 7 #include "base/mac/mac_util.h" | 7 #include "base/mac/mac_util.h" |
| 8 #include "base/sys_string_conversions.h" | 8 #include "base/sys_string_conversions.h" |
| 9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
| 10 #include "chrome/browser/ui/cocoa/browser_window_utils.h" | 10 #include "chrome/browser/ui/cocoa/browser_window_utils.h" |
| 11 #include "chrome/browser/ui/cocoa/extensions/extension_view_mac.h" | 11 #include "chrome/browser/ui/cocoa/extensions/extension_view_mac.h" |
| 12 #include "chrome/browser/ui/tab_contents/tab_contents.h" |
| 12 #include "chrome/common/extensions/extension.h" | 13 #include "chrome/common/extensions/extension.h" |
| 13 #include "content/public/browser/render_widget_host_view.h" | 14 #include "content/public/browser/render_widget_host_view.h" |
| 14 #include "content/public/browser/web_contents.h" | 15 #include "content/public/browser/web_contents.h" |
| 15 #include "content/public/browser/web_contents_view.h" | 16 #include "content/public/browser/web_contents_view.h" |
| 16 #import "ui/base/cocoa/underlay_opengl_hosting_window.h" | 17 #import "ui/base/cocoa/underlay_opengl_hosting_window.h" |
| 17 | 18 |
| 18 @interface NSWindow (NSPrivateApis) | 19 @interface NSWindow (NSPrivateApis) |
| 19 - (void)setBottomCornerRounded:(BOOL)rounded; | 20 - (void)setBottomCornerRounded:(BOOL)rounded; |
| 20 @end | 21 @end |
| 21 | 22 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 41 - (void)windowDidBecomeKey:(NSNotification*)notification { | 42 - (void)windowDidBecomeKey:(NSNotification*)notification { |
| 42 if (shellWindow_) | 43 if (shellWindow_) |
| 43 shellWindow_->WindowDidBecomeKey(); | 44 shellWindow_->WindowDidBecomeKey(); |
| 44 } | 45 } |
| 45 | 46 |
| 46 - (void)windowDidResignKey:(NSNotification*)notification { | 47 - (void)windowDidResignKey:(NSNotification*)notification { |
| 47 if (shellWindow_) | 48 if (shellWindow_) |
| 48 shellWindow_->WindowDidResignKey(); | 49 shellWindow_->WindowDidResignKey(); |
| 49 } | 50 } |
| 50 | 51 |
| 52 - (void)gtm_systemRequestsVisibilityForView:(NSView*)view { |
| 53 [[self window] makeKeyAndOrderFront:self]; |
| 54 } |
| 55 |
| 56 - (void)attachConstrainedWindow:(ConstrainedWindowMac*)window { |
| 57 if (!sheetController_.get()) { |
| 58 sheetController_.reset([[GTMWindowSheetController alloc] |
| 59 initWithWindow:[self window] |
| 60 delegate:self]); |
| 61 } |
| 62 |
| 63 NSView* tabContentsView = |
| 64 [window->owner()->web_contents()->GetNativeView() superview]; |
| 65 window->delegate()->RunSheet(sheetController_, tabContentsView); |
| 66 } |
| 67 |
| 68 - (void)removeConstrainedWindow:(ConstrainedWindowMac*)window { |
| 69 } |
| 70 |
| 71 - (BOOL)canAttachConstrainedWindow { |
| 72 return YES; |
| 73 } |
| 74 |
| 51 @end | 75 @end |
| 52 | 76 |
| 53 @interface ShellNSWindow : UnderlayOpenGLHostingWindow | 77 @interface ShellNSWindow : UnderlayOpenGLHostingWindow |
| 54 | 78 |
| 55 - (void)drawCustomFrameRect:(NSRect)rect forView:(NSView*)view; | 79 - (void)drawCustomFrameRect:(NSRect)rect forView:(NSView*)view; |
| 56 | 80 |
| 57 @end | 81 @end |
| 58 | 82 |
| 59 // This is really a method on NSGrayFrame, so it should only be called on the | 83 // This is really a method on NSGrayFrame, so it should only be called on the |
| 60 // view passed into -[NSWindow drawCustomFrameRect:forView:]. | 84 // view passed into -[NSWindow drawCustomFrameRect:forView:]. |
| (...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 419 return [window_controller_ window]; | 443 return [window_controller_ window]; |
| 420 } | 444 } |
| 421 | 445 |
| 422 // static | 446 // static |
| 423 ShellWindow* ShellWindow::CreateImpl(Profile* profile, | 447 ShellWindow* ShellWindow::CreateImpl(Profile* profile, |
| 424 const extensions::Extension* extension, | 448 const extensions::Extension* extension, |
| 425 const GURL& url, | 449 const GURL& url, |
| 426 const ShellWindow::CreateParams& params) { | 450 const ShellWindow::CreateParams& params) { |
| 427 return new ShellWindowCocoa(profile, extension, url, params); | 451 return new ShellWindowCocoa(profile, extension, url, params); |
| 428 } | 452 } |
| OLD | NEW |