OLD | NEW |
---|---|
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 #import "ui/gfx/mac/nswindow_frame_controls.h" | 5 #import "ui/gfx/mac/nswindow_frame_controls.h" |
6 | 6 |
7 #import "base/mac/mac_util.h" | 7 #import "base/mac/mac_util.h" |
tapted
2016/04/25 21:25:47
remove?
| |
8 #import "base/mac/sdk_forward_declarations.h" | 8 #import "base/mac/sdk_forward_declarations.h" |
9 #include "ui/gfx/geometry/size.h" | 9 #include "ui/gfx/geometry/size.h" |
10 | 10 |
11 namespace { | 11 namespace { |
12 | 12 |
13 // The value used to represent an unbounded width or height. | 13 // The value used to represent an unbounded width or height. |
14 const int kUnboundedSize = 0; | 14 const int kUnboundedSize = 0; |
15 | 15 |
16 void SetResizableStyleMask(NSWindow* window, bool resizable) { | 16 void SetResizableStyleMask(NSWindow* window, bool resizable) { |
17 NSUInteger style_mask = [window styleMask]; | 17 NSUInteger style_mask = [window styleMask]; |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
77 | 77 |
78 CGFloat max_width = | 78 CGFloat max_width = |
79 max_size.width() == kUnboundedSize ? CGFLOAT_MAX : max_size.width(); | 79 max_size.width() == kUnboundedSize ? CGFLOAT_MAX : max_size.width(); |
80 CGFloat max_height = | 80 CGFloat max_height = |
81 max_size.height() == kUnboundedSize ? CGFLOAT_MAX : max_size.height(); | 81 max_size.height() == kUnboundedSize ? CGFLOAT_MAX : max_size.height(); |
82 [window setContentMaxSize:NSMakeSize(max_width, max_height)]; | 82 [window setContentMaxSize:NSMakeSize(max_width, max_height)]; |
83 | 83 |
84 SetResizableStyleMask(window, can_resize); | 84 SetResizableStyleMask(window, can_resize); |
85 [window setShowsResizeIndicator:can_resize]; | 85 [window setShowsResizeIndicator:can_resize]; |
86 | 86 |
87 // Set the window to participate in Lion Fullscreen mode. Setting this flag | 87 // Set the window to participate in Lion Fullscreen mode. |
88 // has no effect on Snow Leopard or earlier. UI controls for fullscreen are | 88 SetNSWindowCanFullscreen(window, can_fullscreen); |
89 // only shown for windows that have unbounded size. | |
90 if (base::mac::IsOSLionOrLater()) | |
91 SetNSWindowCanFullscreen(window, can_fullscreen); | |
92 | 89 |
93 [[window standardWindowButton:NSWindowZoomButton] setEnabled:can_fullscreen]; | 90 [[window standardWindowButton:NSWindowZoomButton] setEnabled:can_fullscreen]; |
94 } | 91 } |
95 | 92 |
96 } // namespace gfx | 93 } // namespace gfx |
OLD | NEW |