Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(420)

Side by Side Diff: chrome/browser/ui/cocoa/extensions/shell_window_cocoa.mm

Issue 10080017: Switch platform apps from a declarative launch container to handling an onLaunched event. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: remove debug logging code Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/ui/browser.cc ('k') | chrome/browser/ui/extensions/shell_window.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/extensions/extension_host.h" 8 #include "chrome/browser/extensions/extension_host.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 12
13 @implementation ShellWindowController 13 @implementation ShellWindowController
14 14
15 @synthesize shellWindow = shellWindow_; 15 @synthesize shellWindow = shellWindow_;
16 16
17 - (void)windowWillClose:(NSNotification*)notification { 17 - (void)windowWillClose:(NSNotification*)notification {
18 if (shellWindow_) 18 if (shellWindow_)
19 shellWindow_->WindowWillClose(); 19 shellWindow_->WindowWillClose();
20 } 20 }
21 21
22 @end 22 @end
23 23
24 ShellWindowCocoa::ShellWindowCocoa(ExtensionHost* host) 24 ShellWindowCocoa::ShellWindowCocoa(ExtensionHost* host)
25 : ShellWindow(host), 25 : ShellWindow(host),
26 attention_request_id_(0) { 26 attention_request_id_(0) {
27 // TOOD(mihaip): Restore prior window dimensions and positions on relaunch. 27 NSRect rect = NSMakeRect(0, 0, kDefaultWidth, kDefaultHeight);
28 NSRect rect = NSZeroRect;
29 rect.size.width = host_->extension()->launch_width();
30 rect.size.height = host_->extension()->launch_height();
31 NSUInteger styleMask = NSTitledWindowMask | NSClosableWindowMask | 28 NSUInteger styleMask = NSTitledWindowMask | NSClosableWindowMask |
32 NSMiniaturizableWindowMask | NSResizableWindowMask; 29 NSMiniaturizableWindowMask | NSResizableWindowMask;
33 scoped_nsobject<NSWindow> window( 30 scoped_nsobject<NSWindow> window(
34 [[NSWindow alloc] initWithContentRect:rect 31 [[NSWindow alloc] initWithContentRect:rect
35 styleMask:styleMask 32 styleMask:styleMask
36 backing:NSBackingStoreBuffered 33 backing:NSBackingStoreBuffered
37 defer:NO]); 34 defer:NO]);
38 [window setTitle:base::SysUTF8ToNSString(host->extension()->name())]; 35 [window setTitle:base::SysUTF8ToNSString(host->extension()->name())];
39 [window setContentMinSize:
40 NSMakeSize(host_->extension()->launch_min_width(),
41 host_->extension()->launch_min_height())];
42 36
43 NSView* view = host->view()->native_view(); 37 NSView* view = host->view()->native_view();
44 [view setFrame:rect]; 38 [view setFrame:rect];
45 [view setAutoresizingMask:NSViewWidthSizable | NSViewHeightSizable]; 39 [view setAutoresizingMask:NSViewWidthSizable | NSViewHeightSizable];
46 [[window contentView] addSubview:view]; 40 [[window contentView] addSubview:view];
47 41
48 window_controller_.reset( 42 window_controller_.reset(
49 [[ShellWindowController alloc] initWithWindow:window.release()]); 43 [[ShellWindowController alloc] initWithWindow:window.release()]);
50 [[window_controller_ window] setDelegate:window_controller_]; 44 [[window_controller_ window] setDelegate:window_controller_];
51 [window_controller_ setShellWindow:this]; 45 [window_controller_ setShellWindow:this];
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 } 160 }
167 161
168 NSWindow* ShellWindowCocoa::window() const { 162 NSWindow* ShellWindowCocoa::window() const {
169 return [window_controller_ window]; 163 return [window_controller_ window];
170 } 164 }
171 165
172 // static 166 // static
173 ShellWindow* ShellWindow::CreateShellWindow(ExtensionHost* host) { 167 ShellWindow* ShellWindow::CreateShellWindow(ExtensionHost* host) {
174 return new ShellWindowCocoa(host); 168 return new ShellWindowCocoa(host);
175 } 169 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/browser.cc ('k') | chrome/browser/ui/extensions/shell_window.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698