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 extensions::Extension* extension, | 28 const extensions::Extension* extension, |
29 const GURL& url, | 29 const GURL& url, |
30 const ShellWindow::CreateParams params) | 30 const ShellWindow::CreateParams& params) |
31 : ShellWindow(profile, extension, url), | 31 : ShellWindow(profile, extension, url), |
32 attention_request_id_(0) { | 32 attention_request_id_(0) { |
33 NSRect rect = NSMakeRect(params.bounds.x(), params.bounds.y(), | 33 NSRect rect = NSMakeRect(params.bounds.x(), params.bounds.y(), |
34 params.bounds.width(), params.bounds.height()); | 34 params.bounds.width(), params.bounds.height()); |
35 NSUInteger styleMask = NSTitledWindowMask | NSClosableWindowMask | | 35 NSUInteger styleMask = NSTitledWindowMask | NSClosableWindowMask | |
36 NSMiniaturizableWindowMask | NSResizableWindowMask; | 36 NSMiniaturizableWindowMask | NSResizableWindowMask; |
37 scoped_nsobject<NSWindow> window([[UnderlayOpenGLHostingWindow alloc] | 37 scoped_nsobject<NSWindow> window([[UnderlayOpenGLHostingWindow alloc] |
38 initWithContentRect:rect | 38 initWithContentRect:rect |
39 styleMask:styleMask | 39 styleMask:styleMask |
40 backing:NSBackingStoreBuffered | 40 backing:NSBackingStoreBuffered |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 } | 170 } |
171 | 171 |
172 NSWindow* ShellWindowCocoa::window() const { | 172 NSWindow* ShellWindowCocoa::window() const { |
173 return [window_controller_ window]; | 173 return [window_controller_ window]; |
174 } | 174 } |
175 | 175 |
176 // static | 176 // static |
177 ShellWindow* ShellWindow::CreateImpl(Profile* profile, | 177 ShellWindow* ShellWindow::CreateImpl(Profile* profile, |
178 const extensions::Extension* extension, | 178 const extensions::Extension* extension, |
179 const GURL& url, | 179 const GURL& url, |
180 const ShellWindow::CreateParams params) { | 180 const ShellWindow::CreateParams& params) { |
181 return new ShellWindowCocoa(profile, extension, url, params); | 181 return new ShellWindowCocoa(profile, extension, url, params); |
182 } | 182 } |
OLD | NEW |