Chromium Code Reviews| 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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 86 const extensions::Extension* extension, | 86 const extensions::Extension* extension, |
| 87 const GURL& url, | 87 const GURL& url, |
| 88 const ShellWindow::CreateParams& params) | 88 const ShellWindow::CreateParams& params) |
| 89 : ShellWindow(profile, extension, url), | 89 : ShellWindow(profile, extension, url), |
| 90 attention_request_id_(0) { | 90 attention_request_id_(0) { |
| 91 // Flip coordinates based on the primary screen. | 91 // Flip coordinates based on the primary screen. |
| 92 NSRect main_screen_rect = [[[NSScreen screens] objectAtIndex:0] frame]; | 92 NSRect main_screen_rect = [[[NSScreen screens] objectAtIndex:0] frame]; |
| 93 NSRect cocoa_bounds = NSMakeRect(params.bounds.x(), | 93 NSRect cocoa_bounds = NSMakeRect(params.bounds.x(), |
| 94 NSHeight(main_screen_rect) - params.bounds.y() - params.bounds.height(), | 94 NSHeight(main_screen_rect) - params.bounds.y() - params.bounds.height(), |
| 95 params.bounds.width(), params.bounds.height()); | 95 params.bounds.width(), params.bounds.height()); |
| 96 NSUInteger style_mask = NSTitledWindowMask | NSClosableWindowMask | | 96 NSUInteger style_mask = NSTexturedBackgroundWindowMask; |
| 97 NSMiniaturizableWindowMask | NSResizableWindowMask | | 97 // Hide titlebar when {frame: 'none'} on ShellWindow. |
|
jeremy
2012/08/05 08:04:21
nit: on -> specified on
| |
| 98 NSTexturedBackgroundWindowMask; | 98 if (params.frame == ShellWindow::CreateParams::FRAME_NONE) |
| 99 style_mask |= NSBorderlessWindowMask; | |
| 100 else | |
| 101 style_mask |= NSTitledWindowMask | NSClosableWindowMask | | |
| 102 NSMiniaturizableWindowMask | NSResizableWindowMask; | |
| 99 scoped_nsobject<NSWindow> window([[ShellNSWindow alloc] | 103 scoped_nsobject<NSWindow> window([[ShellNSWindow alloc] |
| 100 initWithContentRect:cocoa_bounds | 104 initWithContentRect:cocoa_bounds |
| 101 styleMask:style_mask | 105 styleMask:style_mask |
| 102 backing:NSBackingStoreBuffered | 106 backing:NSBackingStoreBuffered |
| 103 defer:NO]); | 107 defer:NO]); |
| 104 [window setTitle:base::SysUTF8ToNSString(extension->name())]; | 108 [window setTitle:base::SysUTF8ToNSString(extension->name())]; |
| 105 gfx::Size min_size = params.minimum_size; | 109 gfx::Size min_size = params.minimum_size; |
| 106 if (min_size.width() || min_size.height()) { | 110 if (min_size.width() || min_size.height()) { |
| 107 [window setContentMinSize:NSMakeSize(min_size.width(), min_size.height())]; | 111 [window setContentMinSize:NSMakeSize(min_size.width(), min_size.height())]; |
| 108 } | 112 } |
| (...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 324 return [window_controller_ window]; | 328 return [window_controller_ window]; |
| 325 } | 329 } |
| 326 | 330 |
| 327 // static | 331 // static |
| 328 ShellWindow* ShellWindow::CreateImpl(Profile* profile, | 332 ShellWindow* ShellWindow::CreateImpl(Profile* profile, |
| 329 const extensions::Extension* extension, | 333 const extensions::Extension* extension, |
| 330 const GURL& url, | 334 const GURL& url, |
| 331 const ShellWindow::CreateParams& params) { | 335 const ShellWindow::CreateParams& params) { |
| 332 return new ShellWindowCocoa(profile, extension, url, params); | 336 return new ShellWindowCocoa(profile, extension, url, params); |
| 333 } | 337 } |
| OLD | NEW |