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

Unified Diff: chrome/browser/ui/views/apps/native_app_window_frame_view_mac.mm

Issue 1146873002: [MacViews] Enable dragging a window by its caption/draggable areas. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Sync and rebase Created 5 years, 7 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: 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
index 444a6df4035c9770e18b577ca1e5c8d7574335ed..e20efc5c32b1f84517c556874c9c6aba08f45f73 100644
--- 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
@@ -6,11 +6,15 @@
#import <Cocoa/Cocoa.h>
+#include "extensions/browser/app_window/native_app_window.h"
+#include "ui/base/hit_test.h"
#import "ui/gfx/mac/coordinate_conversion.h"
#include "ui/views/widget/widget.h"
-NativeAppWindowFrameViewMac::NativeAppWindowFrameViewMac(views::Widget* frame)
- : views::NativeFrameView(frame) {
+NativeAppWindowFrameViewMac::NativeAppWindowFrameViewMac(
+ views::Widget* frame,
+ extensions::NativeAppWindow* window)
+ : views::NativeFrameView(frame), native_app_window_(window) {
}
NativeAppWindowFrameViewMac::~NativeAppWindowFrameViewMac() {
@@ -27,3 +31,19 @@ gfx::Rect NativeAppWindowFrameViewMac::GetWindowBoundsForClientBounds(
window_bounds.set_size(gfx::Size(1, 1));
return window_bounds;
}
+
+int NativeAppWindowFrameViewMac::NonClientHitTest(const gfx::Point& point) {
+ if (!bounds().Contains(point))
+ return HTNOWHERE;
+
+ if (GetWidget()->IsFullscreen())
+ return HTCLIENT;
+
+ // Check for possible draggable region in the client area for the frameless
+ // window.
+ SkRegion* draggable_region = native_app_window_->GetDraggableRegion();
+ if (draggable_region && draggable_region->contains(point.x(), point.y()))
+ return HTCAPTION;
+
+ return HTCLIENT;
+}
« no previous file with comments | « chrome/browser/ui/views/apps/native_app_window_frame_view_mac.h ('k') | chrome/browser/ui/views/frame/browser_frame_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698