| 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 "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/mac/foundation_util.h" | 8 #include "base/mac/foundation_util.h" |
| 9 #include "base/mac/mac_util.h" | 9 #include "base/mac/mac_util.h" |
| 10 #include "base/mac/sdk_forward_declarations.h" | 10 #include "base/mac/sdk_forward_declarations.h" |
| 11 #include "base/strings/sys_string_conversions.h" | 11 #include "base/strings/sys_string_conversions.h" |
| 12 #include "chrome/browser/apps/app_shim/extension_app_shim_handler_mac.h" | 12 #include "chrome/browser/apps/app_shim/extension_app_shim_handler_mac.h" |
| 13 #include "chrome/browser/profiles/profile.h" | 13 #include "chrome/browser/profiles/profile.h" |
| 14 #include "chrome/browser/ui/cocoa/apps/nswindow_util.h" |
| 14 #include "chrome/browser/ui/cocoa/browser_window_utils.h" | 15 #include "chrome/browser/ui/cocoa/browser_window_utils.h" |
| 15 #import "chrome/browser/ui/cocoa/chrome_event_processing_window.h" | 16 #import "chrome/browser/ui/cocoa/chrome_event_processing_window.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 #include "chrome/common/chrome_switches.h" | 19 #include "chrome/common/chrome_switches.h" |
| 19 #include "content/public/browser/native_web_keyboard_event.h" | 20 #include "content/public/browser/native_web_keyboard_event.h" |
| 20 #include "content/public/browser/render_widget_host_view.h" | 21 #include "content/public/browser/render_widget_host_view.h" |
| 21 #include "content/public/browser/web_contents.h" | 22 #include "content/public/browser/web_contents.h" |
| 22 #include "extensions/common/extension.h" | 23 #include "extensions/common/extension.h" |
| 23 #include "skia/ext/skia_utils_mac.h" | 24 #include "skia/ext/skia_utils_mac.h" |
| (...skipping 19 matching lines...) Expand all Loading... |
| 43 | 44 |
| 44 using extensions::AppWindow; | 45 using extensions::AppWindow; |
| 45 | 46 |
| 46 @interface NSWindow (NSPrivateApis) | 47 @interface NSWindow (NSPrivateApis) |
| 47 - (void)setBottomCornerRounded:(BOOL)rounded; | 48 - (void)setBottomCornerRounded:(BOOL)rounded; |
| 48 - (BOOL)_isTitleHidden; | 49 - (BOOL)_isTitleHidden; |
| 49 @end | 50 @end |
| 50 | 51 |
| 51 namespace { | 52 namespace { |
| 52 | 53 |
| 53 void SetFullScreenCollectionBehavior(NSWindow* window, bool allow_fullscreen) { | |
| 54 NSWindowCollectionBehavior behavior = [window collectionBehavior]; | |
| 55 if (allow_fullscreen) | |
| 56 behavior |= NSWindowCollectionBehaviorFullScreenPrimary; | |
| 57 else | |
| 58 behavior &= ~NSWindowCollectionBehaviorFullScreenPrimary; | |
| 59 [window setCollectionBehavior:behavior]; | |
| 60 } | |
| 61 | |
| 62 void SetWorkspacesCollectionBehavior(NSWindow* window, bool always_visible) { | 54 void SetWorkspacesCollectionBehavior(NSWindow* window, bool always_visible) { |
| 63 NSWindowCollectionBehavior behavior = [window collectionBehavior]; | 55 NSWindowCollectionBehavior behavior = [window collectionBehavior]; |
| 64 if (always_visible) | 56 if (always_visible) |
| 65 behavior |= NSWindowCollectionBehaviorCanJoinAllSpaces; | 57 behavior |= NSWindowCollectionBehaviorCanJoinAllSpaces; |
| 66 else | 58 else |
| 67 behavior &= ~NSWindowCollectionBehaviorCanJoinAllSpaces; | 59 behavior &= ~NSWindowCollectionBehaviorCanJoinAllSpaces; |
| 68 [window setCollectionBehavior:behavior]; | 60 [window setCollectionBehavior:behavior]; |
| 69 } | 61 } |
| 70 | 62 |
| 71 void InitCollectionBehavior(NSWindow* window) { | 63 void InitCollectionBehavior(NSWindow* window) { |
| (...skipping 913 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 985 } | 977 } |
| 986 | 978 |
| 987 void NativeAppWindowCocoa::UpdateRestoredBounds() { | 979 void NativeAppWindowCocoa::UpdateRestoredBounds() { |
| 988 if (IsRestored(*this)) | 980 if (IsRestored(*this)) |
| 989 restored_bounds_ = [window() frame]; | 981 restored_bounds_ = [window() frame]; |
| 990 } | 982 } |
| 991 | 983 |
| 992 void NativeAppWindowCocoa::HideWithoutMarkingHidden() { | 984 void NativeAppWindowCocoa::HideWithoutMarkingHidden() { |
| 993 [window() orderOut:window_controller_]; | 985 [window() orderOut:window_controller_]; |
| 994 } | 986 } |
| OLD | NEW |