[MacViews] Enable dragging a window by its caption/draggable areas.
commitdc783c7be84a2a8c5564736f4b17a4fbd03897d6
authorjackhou <jackhou@chromium.org>
Tue, 9 Jun 2015 00:57:02 +0000 (8 17:57 -0700)
committerCommit bot <commit-bot@chromium.org>
Tue, 9 Jun 2015 00:57:40 +0000 (9 00:57 +0000)
tree01ea4e8eda9f30e8c1c0e195832856f31a7487af
parent651d96441670ca1f4f7d6fadec0690d1f64e95b4
[MacViews] Enable dragging a window by its caption/draggable areas.

This works by making all subviews of [NSWindow contentView] draggable.
I.e. they return YES for mouseDownCanMoveWindow. The content view
itself is initially non-draggable. BridgedNativeWidget watches for any
mouse-downs and tests whether they should drag the window. If so, it
makes the content view draggable and reposts the event.

The event is reposted at the kCGSessionEventTap level because window
dragging seems to be handled there before the event is sent to the
application.

When BridgedNativeWidget sees the reposted mouse-down, window dragging
will have started, so the content view can be made non-draggable again.

BUG=485394,459877

Review URL: https://codereview.chromium.org/1146873002

Cr-Commit-Position: refs/heads/master@{#333410}
20 files changed:
chrome/browser/apps/app_shim/app_shim_interactive_uitest_mac.mm
chrome/browser/ui/views/apps/chrome_native_app_window_views_mac.h
chrome/browser/ui/views/apps/chrome_native_app_window_views_mac.mm
chrome/browser/ui/views/apps/native_app_window_frame_view_mac.h
chrome/browser/ui/views/apps/native_app_window_frame_view_mac.mm
chrome/browser/ui/views/frame/browser_frame_mac.mm
chrome/browser/ui/views/frame/browser_non_client_frame_view_mac.mm
ui/base/BUILD.gn
ui/base/test/windowed_nsnotification_observer.h [new file with mode: 0644]
ui/base/test/windowed_nsnotification_observer.mm [new file with mode: 0644]
ui/base/ui_base.gyp
ui/views/cocoa/bridged_content_view.h
ui/views/cocoa/bridged_content_view.mm
ui/views/cocoa/bridged_native_widget.h
ui/views/cocoa/bridged_native_widget.mm
ui/views/cocoa/bridged_native_widget_interactive_uitest.mm
ui/views/cocoa/views_nswindow_delegate.h
ui/views/cocoa/views_nswindow_delegate.mm
ui/views/widget/native_widget_mac.h
ui/views/widget/native_widget_mac.mm