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

Unified Diff: ui/views/cocoa/bridged_native_widget.mm

Issue 1023083002: [MacViews] Implement size constraints for app windows. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address comments. 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/cocoa/bridged_native_widget.mm
diff --git a/ui/views/cocoa/bridged_native_widget.mm b/ui/views/cocoa/bridged_native_widget.mm
index 74ac56afef7c75d65389c033a4bb91660b175658..87b7741359edf9cfb9961676a172c86ba73f382d 100644
--- a/ui/views/cocoa/bridged_native_widget.mm
+++ b/ui/views/cocoa/bridged_native_widget.mm
@@ -16,6 +16,7 @@
#include "ui/gfx/display.h"
#include "ui/gfx/geometry/dip_util.h"
#import "ui/gfx/mac/coordinate_conversion.h"
+#import "ui/gfx/mac/nswindow_util.h"
#include "ui/gfx/screen.h"
#import "ui/views/cocoa/cocoa_mouse_capture.h"
#import "ui/views/cocoa/bridged_content_view.h"
@@ -27,6 +28,7 @@
#include "ui/views/views_delegate.h"
#include "ui/views/widget/widget.h"
#include "ui/views/widget/widget_aura_utils.h"
+#include "ui/views/widget/widget_delegate.h"
// The NSView that hosts the composited CALayer drawing the UI. It fills the
// window but is not hittable so that accessibility hit tests always go to the
@@ -488,6 +490,21 @@ void BridgedNativeWidget::OnWindowKeyStatusChangedTo(bool is_key) {
}
}
+void BridgedNativeWidget::OnSizeConstraintsChanged() {
+ NSWindow* window = ns_window();
+ Widget* widget = native_widget_mac()->GetWidget();
+ gfx::Size min_size = widget->GetMinimumSize();
+ gfx::Size max_size = widget->GetMaximumSize();
+ bool is_resizable = widget->widget_delegate()->CanResize();
+ bool shows_resize_controls =
+ is_resizable && (min_size.IsEmpty() || min_size != max_size);
+ bool shows_fullscreen_controls =
+ is_resizable && widget->widget_delegate()->CanMaximize();
+
+ ApplySizeConstraints(window, min_size, max_size, shows_resize_controls,
+ shows_fullscreen_controls);
+}
+
InputMethod* BridgedNativeWidget::CreateInputMethod() {
if (switches::IsTextInputFocusManagerEnabled())
return new NullInputMethod();

Powered by Google App Engine
This is Rietveld 408576698