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 "content/shell/shell.h" | 5 #include "content/shell/shell.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/command_line.h" | |
10 #include "base/logging.h" | 9 #include "base/logging.h" |
11 #import "base/memory/scoped_nsobject.h" | 10 #import "base/memory/scoped_nsobject.h" |
12 #include "base/string_piece.h" | 11 #include "base/string_piece.h" |
13 #include "base/sys_string_conversions.h" | 12 #include "base/sys_string_conversions.h" |
14 #include "content/public/browser/native_web_keyboard_event.h" | 13 #include "content/public/browser/native_web_keyboard_event.h" |
15 #include "content/public/browser/web_contents.h" | 14 #include "content/public/browser/web_contents.h" |
16 #include "content/public/browser/web_contents_view.h" | 15 #include "content/public/browser/web_contents_view.h" |
17 #include "content/shell/resource.h" | 16 #include "content/shell/resource.h" |
18 #include "content/shell/shell_switches.h" | |
19 #include "googleurl/src/gurl.h" | 17 #include "googleurl/src/gurl.h" |
20 #import "ui/base/cocoa/underlay_opengl_hosting_window.h" | 18 #import "ui/base/cocoa/underlay_opengl_hosting_window.h" |
21 | 19 |
22 #if !defined(MAC_OS_X_VERSION_10_7) || \ | 20 #if !defined(MAC_OS_X_VERSION_10_7) || \ |
23 MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_7 | 21 MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_7 |
24 | 22 |
25 enum { | 23 enum { |
26 NSWindowCollectionBehaviorFullScreenPrimary = 1 << 7, | 24 NSWindowCollectionBehaviorFullScreenPrimary = 1 << 7, |
27 NSWindowCollectionBehaviorFullScreenAuxiliary = 1 << 8 | 25 NSWindowCollectionBehaviorFullScreenAuxiliary = 1 << 8 |
28 }; | 26 }; |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 } | 171 } |
174 | 172 |
175 void Shell::PlatformCreateWindow(int width, int height) { | 173 void Shell::PlatformCreateWindow(int width, int height) { |
176 NSRect initial_window_bounds = | 174 NSRect initial_window_bounds = |
177 NSMakeRect(0, 0, width, height + kURLBarHeight); | 175 NSMakeRect(0, 0, width, height + kURLBarHeight); |
178 NSRect content_rect = initial_window_bounds; | 176 NSRect content_rect = initial_window_bounds; |
179 NSUInteger style_mask = NSTitledWindowMask | | 177 NSUInteger style_mask = NSTitledWindowMask | |
180 NSClosableWindowMask | | 178 NSClosableWindowMask | |
181 NSMiniaturizableWindowMask | | 179 NSMiniaturizableWindowMask | |
182 NSResizableWindowMask; | 180 NSResizableWindowMask; |
183 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kDumpRenderTree)) { | |
184 content_rect = NSOffsetRect(initial_window_bounds, -10000, -10000); | |
185 style_mask = NSBorderlessWindowMask; | |
186 } | |
187 CrShellWindow* window = | 181 CrShellWindow* window = |
188 [[CrShellWindow alloc] initWithContentRect:content_rect | 182 [[CrShellWindow alloc] initWithContentRect:content_rect |
189 styleMask:style_mask | 183 styleMask:style_mask |
190 backing:NSBackingStoreBuffered | 184 backing:NSBackingStoreBuffered |
191 defer:NO]; | 185 defer:NO]; |
192 window_ = window; | 186 window_ = window; |
193 [window setShell:this]; | 187 [window setShell:this]; |
194 [window_ setTitle:kWindowTitle]; | 188 [window_ setTitle:kWindowTitle]; |
195 NSView* content = [window_ contentView]; | 189 NSView* content = [window_ contentView]; |
196 | 190 |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
310 [[event.os_event characters] isEqual:@"l"]) { | 304 [[event.os_event characters] isEqual:@"l"]) { |
311 [window_ makeFirstResponder:url_edit_view_]; | 305 [window_ makeFirstResponder:url_edit_view_]; |
312 return; | 306 return; |
313 } | 307 } |
314 | 308 |
315 [[NSApp mainMenu] performKeyEquivalent:event.os_event]; | 309 [[NSApp mainMenu] performKeyEquivalent:event.os_event]; |
316 } | 310 } |
317 } | 311 } |
318 | 312 |
319 } // namespace content | 313 } // namespace content |
OLD | NEW |