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

Unified Diff: chrome/browser/ui/views/apps/native_app_window_frame_view_mac.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 | « chrome/browser/ui/views/apps/native_app_window_frame_view_mac.h ('k') | chrome/chrome_browser_ui.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/views/apps/native_app_window_frame_view_mac.mm
diff --git a/chrome/browser/ui/views/apps/native_app_window_frame_view_mac.mm b/chrome/browser/ui/views/apps/native_app_window_frame_view_mac.mm
new file mode 100644
index 0000000000000000000000000000000000000000..444a6df4035c9770e18b577ca1e5c8d7574335ed
--- /dev/null
+++ b/chrome/browser/ui/views/apps/native_app_window_frame_view_mac.mm
@@ -0,0 +1,29 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/ui/views/apps/native_app_window_frame_view_mac.h"
+
+#import <Cocoa/Cocoa.h>
+
+#import "ui/gfx/mac/coordinate_conversion.h"
+#include "ui/views/widget/widget.h"
+
+NativeAppWindowFrameViewMac::NativeAppWindowFrameViewMac(views::Widget* frame)
+ : views::NativeFrameView(frame) {
+}
+
+NativeAppWindowFrameViewMac::~NativeAppWindowFrameViewMac() {
+}
+
+gfx::Rect NativeAppWindowFrameViewMac::GetWindowBoundsForClientBounds(
+ const gfx::Rect& client_bounds) const {
+ NSWindow* ns_window = GetWidget()->GetNativeWindow();
+ gfx::Rect window_bounds = gfx::ScreenRectFromNSRect([ns_window
+ frameRectForContentRect:gfx::ScreenRectToNSRect(client_bounds)]);
+ // Enforce minimum size (1, 1) in case that |client_bounds| is passed with
+ // empty size.
+ if (window_bounds.IsEmpty())
+ window_bounds.set_size(gfx::Size(1, 1));
+ return window_bounds;
+}
« no previous file with comments | « chrome/browser/ui/views/apps/native_app_window_frame_view_mac.h ('k') | chrome/chrome_browser_ui.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698