Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(417)

Unified Diff: ui/views/widget/native_widget_mac.mm

Issue 1023083002: [MacViews] Implement size constraints for app windows. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ui/views/widget/native_widget_mac.mm
diff --git a/ui/views/widget/native_widget_mac.mm b/ui/views/widget/native_widget_mac.mm
index eaad5c99e7634d52f00938be3178683009346bfc..3ab80874b11adcee58254d25da59172dd4847f7c 100644
--- a/ui/views/widget/native_widget_mac.mm
+++ b/ui/views/widget/native_widget_mac.mm
@@ -22,6 +22,9 @@
namespace views {
namespace {
+// The value used to represent an unbounded width or height.
+const int kUnboundedSize = 0;
+
NSInteger StyleMaskForParams(const Widget::InitParams& params) {
// TODO(tapted): Determine better masks when there are use cases for it.
if (params.remove_standard_frame)
@@ -526,7 +529,19 @@ bool NativeWidgetMac::IsTranslucentWindowOpacitySupported() const {
}
void NativeWidgetMac::OnSizeConstraintsChanged() {
tapted 2015/03/20 12:12:53 Aura widgets also call this towards the end of Ini
jackhou1 2015/03/25 23:32:23 ChromeNativeAppWindowViews::InitializeDefaultWindo
- NOTIMPLEMENTED();
+ NSWindow* window = GetNativeWindow();
+ gfx::Size minimum_size = delegate()->GetMinimumSize();
+ [window setContentMinSize:NSMakeSize(minimum_size.width(),
+ minimum_size.height())];
+
+ gfx::Size maximum_size = delegate()->GetMaximumSize();
+ CGFloat max_width = maximum_size.width() == kUnboundedSize
+ ? CGFLOAT_MAX
+ : maximum_size.width();
+ CGFloat max_height = maximum_size.height() == kUnboundedSize
+ ? CGFLOAT_MAX
+ : maximum_size.height();
+ [window setContentMaxSize:NSMakeSize(max_width, max_height)];
}
void NativeWidgetMac::RepostNativeEvent(gfx::NativeEvent native_event) {
« chrome/browser/ui/views/apps/app_window_native_widget_mac.mm ('K') | « chrome/chrome_browser_ui.gypi ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698