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" |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 params.bounds.width(), params.bounds.height()); | 85 params.bounds.width(), params.bounds.height()); |
86 NSUInteger style_mask = NSTitledWindowMask | NSClosableWindowMask | | 86 NSUInteger style_mask = NSTitledWindowMask | NSClosableWindowMask | |
87 NSMiniaturizableWindowMask | NSResizableWindowMask | | 87 NSMiniaturizableWindowMask | NSResizableWindowMask | |
88 NSTexturedBackgroundWindowMask; | 88 NSTexturedBackgroundWindowMask; |
89 scoped_nsobject<NSWindow> window([[ShellNSWindow alloc] | 89 scoped_nsobject<NSWindow> window([[ShellNSWindow alloc] |
90 initWithContentRect:cocoa_bounds | 90 initWithContentRect:cocoa_bounds |
91 styleMask:style_mask | 91 styleMask:style_mask |
92 backing:NSBackingStoreBuffered | 92 backing:NSBackingStoreBuffered |
93 defer:NO]); | 93 defer:NO]); |
94 [window setTitle:base::SysUTF8ToNSString(extension->name())]; | 94 [window setTitle:base::SysUTF8ToNSString(extension->name())]; |
95 gfx::Size min_size = params.maximum_size; | 95 gfx::Size min_size = params.minimum_size; |
96 if (min_size.width() || min_size.height()) { | 96 if (min_size.width() || min_size.height()) { |
97 [window setContentMinSize:NSMakeSize(min_size.width(), min_size.height())]; | 97 [window setContentMinSize:NSMakeSize(min_size.width(), min_size.height())]; |
98 } | 98 } |
99 gfx::Size max_size = params.maximum_size; | 99 gfx::Size max_size = params.maximum_size; |
100 if (max_size.width() || max_size.height()) { | 100 if (max_size.width() || max_size.height()) { |
101 CGFloat max_width = max_size.width() ? max_size.width() : CGFLOAT_MAX; | 101 CGFloat max_width = max_size.width() ? max_size.width() : CGFLOAT_MAX; |
102 CGFloat max_height = max_size.height() ? max_size.height() : CGFLOAT_MAX; | 102 CGFloat max_height = max_size.height() ? max_size.height() : CGFLOAT_MAX; |
103 [window setContentMaxSize:NSMakeSize(max_width, max_height)]; | 103 [window setContentMaxSize:NSMakeSize(max_width, max_height)]; |
104 } | 104 } |
105 | 105 |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
314 return [window_controller_ window]; | 314 return [window_controller_ window]; |
315 } | 315 } |
316 | 316 |
317 // static | 317 // static |
318 ShellWindow* ShellWindow::CreateImpl(Profile* profile, | 318 ShellWindow* ShellWindow::CreateImpl(Profile* profile, |
319 const extensions::Extension* extension, | 319 const extensions::Extension* extension, |
320 const GURL& url, | 320 const GURL& url, |
321 const ShellWindow::CreateParams& params) { | 321 const ShellWindow::CreateParams& params) { |
322 return new ShellWindowCocoa(profile, extension, url, params); | 322 return new ShellWindowCocoa(profile, extension, url, params); |
323 } | 323 } |
OLD | NEW |