OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/apps/native_app_window_cocoa.h" | 5 #include "chrome/browser/ui/cocoa/apps/native_app_window_cocoa.h" |
6 | 6 |
7 #include "apps/app_shim/extension_app_shim_handler_mac.h" | 7 #include "apps/app_shim/extension_app_shim_handler_mac.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/mac/foundation_util.h" | 9 #include "base/mac/foundation_util.h" |
10 #include "base/mac/mac_util.h" | 10 #include "base/mac/mac_util.h" |
| 11 #include "base/mac/sdk_forward_declarations.h" |
11 #include "base/strings/sys_string_conversions.h" | 12 #include "base/strings/sys_string_conversions.h" |
12 #include "chrome/browser/profiles/profile.h" | 13 #include "chrome/browser/profiles/profile.h" |
13 #include "chrome/browser/ui/cocoa/browser_window_utils.h" | 14 #include "chrome/browser/ui/cocoa/browser_window_utils.h" |
14 #import "chrome/browser/ui/cocoa/chrome_event_processing_window.h" | 15 #import "chrome/browser/ui/cocoa/chrome_event_processing_window.h" |
15 #import "chrome/browser/ui/cocoa/custom_frame_view.h" | 16 #import "chrome/browser/ui/cocoa/custom_frame_view.h" |
16 #include "chrome/browser/ui/cocoa/extensions/extension_keybinding_registry_cocoa
.h" | 17 #include "chrome/browser/ui/cocoa/extensions/extension_keybinding_registry_cocoa
.h" |
17 #include "chrome/browser/ui/cocoa/extensions/extension_view_mac.h" | 18 #include "chrome/browser/ui/cocoa/extensions/extension_view_mac.h" |
18 #import "chrome/browser/ui/cocoa/nsview_additions.h" | 19 #import "chrome/browser/ui/cocoa/nsview_additions.h" |
19 #include "chrome/common/chrome_switches.h" | 20 #include "chrome/common/chrome_switches.h" |
20 #include "content/public/browser/native_web_keyboard_event.h" | 21 #include "content/public/browser/native_web_keyboard_event.h" |
(...skipping 21 matching lines...) Expand all Loading... |
42 // windowWillUseStandardFrame, as the window would not restore back to the | 43 // windowWillUseStandardFrame, as the window would not restore back to the |
43 // desired size. | 44 // desired size. |
44 | 45 |
45 using apps::AppWindow; | 46 using apps::AppWindow; |
46 | 47 |
47 @interface NSWindow (NSPrivateApis) | 48 @interface NSWindow (NSPrivateApis) |
48 - (void)setBottomCornerRounded:(BOOL)rounded; | 49 - (void)setBottomCornerRounded:(BOOL)rounded; |
49 - (BOOL)_isTitleHidden; | 50 - (BOOL)_isTitleHidden; |
50 @end | 51 @end |
51 | 52 |
52 // Replicate specific 10.7 SDK declarations for building with prior SDKs. | |
53 #if !defined(MAC_OS_X_VERSION_10_7) || \ | |
54 MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_7 | |
55 | |
56 @interface NSWindow (LionSDKDeclarations) | |
57 - (void)toggleFullScreen:(id)sender; | |
58 @end | |
59 | |
60 enum { | |
61 NSWindowCollectionBehaviorFullScreenPrimary = 1 << 7, | |
62 NSFullScreenWindowMask = 1 << 14 | |
63 }; | |
64 | |
65 #endif // MAC_OS_X_VERSION_10_7 | |
66 | |
67 namespace { | 53 namespace { |
68 | 54 |
69 void SetFullScreenCollectionBehavior(NSWindow* window, bool allow_fullscreen) { | 55 void SetFullScreenCollectionBehavior(NSWindow* window, bool allow_fullscreen) { |
70 NSWindowCollectionBehavior behavior = [window collectionBehavior]; | 56 NSWindowCollectionBehavior behavior = [window collectionBehavior]; |
71 if (allow_fullscreen) | 57 if (allow_fullscreen) |
72 behavior |= NSWindowCollectionBehaviorFullScreenPrimary; | 58 behavior |= NSWindowCollectionBehaviorFullScreenPrimary; |
73 else | 59 else |
74 behavior &= ~NSWindowCollectionBehaviorFullScreenPrimary; | 60 behavior &= ~NSWindowCollectionBehaviorFullScreenPrimary; |
75 [window setCollectionBehavior:behavior]; | 61 [window setCollectionBehavior:behavior]; |
76 } | 62 } |
(...skipping 900 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
977 } | 963 } |
978 | 964 |
979 void NativeAppWindowCocoa::UpdateRestoredBounds() { | 965 void NativeAppWindowCocoa::UpdateRestoredBounds() { |
980 if (IsRestored(*this)) | 966 if (IsRestored(*this)) |
981 restored_bounds_ = [window() frame]; | 967 restored_bounds_ = [window() frame]; |
982 } | 968 } |
983 | 969 |
984 void NativeAppWindowCocoa::HideWithoutMarkingHidden() { | 970 void NativeAppWindowCocoa::HideWithoutMarkingHidden() { |
985 [window() orderOut:window_controller_]; | 971 [window() orderOut:window_controller_]; |
986 } | 972 } |
OLD | NEW |