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" |
(...skipping 957 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
968 [[window() standardWindowButton:NSWindowZoomButton] | 968 [[window() standardWindowButton:NSWindowZoomButton] |
969 setEnabled:shows_fullscreen_controls_]; | 969 setEnabled:shows_fullscreen_controls_]; |
970 } | 970 } |
971 } | 971 } |
972 | 972 |
973 void NativeAppWindowCocoa::SetAlwaysOnTop(bool always_on_top) { | 973 void NativeAppWindowCocoa::SetAlwaysOnTop(bool always_on_top) { |
974 [window() setLevel:(always_on_top ? AlwaysOnTopWindowLevel() : | 974 [window() setLevel:(always_on_top ? AlwaysOnTopWindowLevel() : |
975 NSNormalWindowLevel)]; | 975 NSNormalWindowLevel)]; |
976 } | 976 } |
977 | 977 |
| 978 void NativeAppWindowCocoa::SetVisibleOnAllWorkspaces(bool always_visible) { |
| 979 NSWindowCollectionBehavior behavior = [window() collectionBehavior]; |
| 980 if (always_visible) |
| 981 behavior |= NSWindowCollectionBehaviorCanJoinAllSpaces; |
| 982 else |
| 983 behavior &= ~NSWindowCollectionBehaviorCanJoinAllSpaces; |
| 984 [window() setCollectionBehavior:behavior]; |
| 985 } |
| 986 |
978 NativeAppWindowCocoa::~NativeAppWindowCocoa() { | 987 NativeAppWindowCocoa::~NativeAppWindowCocoa() { |
979 } | 988 } |
980 | 989 |
981 ShellNSWindow* NativeAppWindowCocoa::window() const { | 990 ShellNSWindow* NativeAppWindowCocoa::window() const { |
982 NSWindow* window = [window_controller_ window]; | 991 NSWindow* window = [window_controller_ window]; |
983 CHECK(!window || [window isKindOfClass:[ShellNSWindow class]]); | 992 CHECK(!window || [window isKindOfClass:[ShellNSWindow class]]); |
984 return static_cast<ShellNSWindow*>(window); | 993 return static_cast<ShellNSWindow*>(window); |
985 } | 994 } |
986 | 995 |
987 content::WebContents* NativeAppWindowCocoa::WebContents() const { | 996 content::WebContents* NativeAppWindowCocoa::WebContents() const { |
988 return app_window_->web_contents(); | 997 return app_window_->web_contents(); |
989 } | 998 } |
990 | 999 |
991 void NativeAppWindowCocoa::UpdateRestoredBounds() { | 1000 void NativeAppWindowCocoa::UpdateRestoredBounds() { |
992 if (IsRestored(*this)) | 1001 if (IsRestored(*this)) |
993 restored_bounds_ = [window() frame]; | 1002 restored_bounds_ = [window() frame]; |
994 } | 1003 } |
995 | 1004 |
996 void NativeAppWindowCocoa::HideWithoutMarkingHidden() { | 1005 void NativeAppWindowCocoa::HideWithoutMarkingHidden() { |
997 [window() orderOut:window_controller_]; | 1006 [window() orderOut:window_controller_]; |
998 } | 1007 } |
OLD | NEW |