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/sys_string_conversions.h" | 7 #include "base/sys_string_conversions.h" |
8 #include "chrome/browser/profiles/profile.h" | 8 #include "chrome/browser/profiles/profile.h" |
9 #include "chrome/browser/ui/cocoa/browser_window_utils.h" | 9 #include "chrome/browser/ui/cocoa/browser_window_utils.h" |
10 #include "chrome/browser/ui/cocoa/extensions/extension_view_mac.h" | 10 #include "chrome/browser/ui/cocoa/extensions/extension_view_mac.h" |
11 #include "chrome/common/extensions/extension.h" | 11 #include "chrome/common/extensions/extension.h" |
12 #include "content/public/browser/web_contents.h" | 12 #include "content/public/browser/web_contents.h" |
13 #include "content/public/browser/web_contents_view.h" | 13 #include "content/public/browser/web_contents_view.h" |
14 #import "ui/base/cocoa/underlay_opengl_hosting_window.h" | 14 #import "ui/base/cocoa/underlay_opengl_hosting_window.h" |
15 | 15 |
16 @implementation ShellWindowController | 16 @implementation ShellWindowController |
17 | 17 |
18 @synthesize shellWindow = shellWindow_; | 18 @synthesize shellWindow = shellWindow_; |
19 | 19 |
20 - (void)windowWillClose:(NSNotification*)notification { | 20 - (void)windowWillClose:(NSNotification*)notification { |
21 if (shellWindow_) | 21 if (shellWindow_) |
22 shellWindow_->WindowWillClose(); | 22 shellWindow_->WindowWillClose(); |
23 } | 23 } |
24 | 24 |
25 @end | 25 @end |
26 | 26 |
27 ShellWindowCocoa::ShellWindowCocoa(Profile* profile, | 27 ShellWindowCocoa::ShellWindowCocoa(Profile* profile, |
28 const Extension* extension, | 28 const extensions::Extension* extension, |
29 const GURL& url) | 29 const GURL& url) |
30 : ShellWindow(profile, extension, url), | 30 : ShellWindow(profile, extension, url), |
31 attention_request_id_(0) { | 31 attention_request_id_(0) { |
32 NSRect rect = NSMakeRect(0, 0, kDefaultWidth, kDefaultHeight); | 32 NSRect rect = NSMakeRect(0, 0, kDefaultWidth, kDefaultHeight); |
33 NSUInteger styleMask = NSTitledWindowMask | NSClosableWindowMask | | 33 NSUInteger styleMask = NSTitledWindowMask | NSClosableWindowMask | |
34 NSMiniaturizableWindowMask | NSResizableWindowMask; | 34 NSMiniaturizableWindowMask | NSResizableWindowMask; |
35 scoped_nsobject<NSWindow> window([[UnderlayOpenGLHostingWindow alloc] | 35 scoped_nsobject<NSWindow> window([[UnderlayOpenGLHostingWindow alloc] |
36 initWithContentRect:rect | 36 initWithContentRect:rect |
37 styleMask:styleMask | 37 styleMask:styleMask |
38 backing:NSBackingStoreBuffered | 38 backing:NSBackingStoreBuffered |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 | 163 |
164 ShellWindowCocoa::~ShellWindowCocoa() { | 164 ShellWindowCocoa::~ShellWindowCocoa() { |
165 } | 165 } |
166 | 166 |
167 NSWindow* ShellWindowCocoa::window() const { | 167 NSWindow* ShellWindowCocoa::window() const { |
168 return [window_controller_ window]; | 168 return [window_controller_ window]; |
169 } | 169 } |
170 | 170 |
171 // static | 171 // static |
172 ShellWindow* ShellWindow::CreateImpl(Profile* profile, | 172 ShellWindow* ShellWindow::CreateImpl(Profile* profile, |
173 const Extension* extension, | 173 const extensions::Extension* extension, |
174 const GURL& url) { | 174 const GURL& url) { |
175 return new ShellWindowCocoa(profile, extension, url); | 175 return new ShellWindowCocoa(profile, extension, url); |
176 } | 176 } |
OLD | NEW |