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

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: Update ui/gfx/BUILD.gn 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
« no previous file with comments | « ui/views/cocoa/bridged_native_widget.h ('k') | ui/views/widget/native_widget_mac.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..874dce699a4a1cfd727fc5b731547b101a8e9e7a 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_frame_controls.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,22 @@ 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();
+
+ gfx::ApplyNSWindowSizeConstraints(window, min_size, max_size,
+ shows_resize_controls,
+ shows_fullscreen_controls);
+}
+
InputMethod* BridgedNativeWidget::CreateInputMethod() {
if (switches::IsTextInputFocusManagerEnabled())
return new NullInputMethod();
« no previous file with comments | « ui/views/cocoa/bridged_native_widget.h ('k') | ui/views/widget/native_widget_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698