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

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: Change to single repost and [NSWindow setMovableByWindowBackground]. 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..8aa790a9b268f036d0fa45f83dccee372bf20e8c 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,17 @@ gfx::Rect NativeAppWindowFrameViewMac::GetWindowBoundsForClientBounds(
window_bounds.set_size(gfx::Size(1, 1));
return window_bounds;
}
+
+int NativeAppWindowFrameViewMac::NonClientHitTest(const gfx::Point& point) {
+ DCHECK(bounds().Contains(point));
jackhou1 2015/06/02 06:33:09 Ah, I think this still needs to be fixed. It shoul
jackhou1 2015/06/03 04:04:44 Done.
+ 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;
+}

Powered by Google App Engine
This is Rietveld 408576698