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