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

Unified Diff: ui/views/cocoa/bridged_native_widget.h

Issue 789763002: MacViews: Implement capture using NSEvent local+global monitors (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@20140812-MacViews-LAYERS2-PRESQUASH
Patch Set: fix sorting Created 6 years 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_content_view.mm ('k') | ui/views/cocoa/bridged_native_widget.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.h
diff --git a/ui/views/cocoa/bridged_native_widget.h b/ui/views/cocoa/bridged_native_widget.h
index 5f495f8982fe368bae4da308e08360b71bcee349..adb232cd1406583e88e9a0ab30d3508906e26fba 100644
--- a/ui/views/cocoa/bridged_native_widget.h
+++ b/ui/views/cocoa/bridged_native_widget.h
@@ -12,6 +12,7 @@
#include "base/memory/scoped_ptr.h"
#include "ui/compositor/layer_owner.h"
#import "ui/accelerated_widget_mac/accelerated_widget_mac.h"
+#import "ui/views/cocoa/cocoa_mouse_capture_delegate.h"
#import "ui/views/focus/focus_manager.h"
#include "ui/views/ime/input_method_delegate.h"
#include "ui/views/views_export.h"
@@ -26,6 +27,7 @@ class InputMethod;
namespace views {
+class CocoaMouseCapture;
class InputMethod;
class NativeWidgetMac;
class View;
@@ -36,6 +38,7 @@ class View;
class VIEWS_EXPORT BridgedNativeWidget : public ui::LayerDelegate,
public ui::LayerOwner,
public internal::InputMethodDelegate,
+ public CocoaMouseCaptureDelegate,
public FocusChangeListener,
public ui::AcceleratedWidgetMacNSView {
public:
@@ -70,6 +73,12 @@ class VIEWS_EXPORT BridgedNativeWidget : public ui::LayerDelegate,
// descendant windows where necessary.
void SetVisibilityState(WindowVisibilityState new_state);
+ // Acquiring mouse capture first steals capture from any existing
+ // CocoaMouseCaptureDelegate, then captures all mouse events until released.
+ void AcquireCapture();
+ void ReleaseCapture();
+ bool HasCapture();
+
// Called internally by the NSWindowDelegate when the window is closing.
void OnWindowWillClose();
@@ -158,6 +167,10 @@ class VIEWS_EXPORT BridgedNativeWidget : public ui::LayerDelegate,
// scale factor.
void UpdateLayerProperties();
+ // Overridden from CocoaMouseCaptureDelegate:
+ void PostCapturedEvent(NSEvent* event) override;
+ void OnMouseCaptureLost() override;
+
// Overridden from FocusChangeListener:
void OnWillChangeFocus(View* focused_before,
View* focused_now) override;
@@ -182,6 +195,7 @@ class VIEWS_EXPORT BridgedNativeWidget : public ui::LayerDelegate,
base::scoped_nsobject<ViewsNSWindowDelegate> window_delegate_;
base::scoped_nsobject<BridgedContentView> bridged_view_;
scoped_ptr<ui::InputMethod> input_method_;
+ scoped_ptr<CocoaMouseCapture> mouse_capture_;
FocusManager* focus_manager_; // Weak. Owned by our Widget.
BridgedNativeWidget* parent_; // Weak. If non-null, owns this.
« no previous file with comments | « ui/views/cocoa/bridged_content_view.mm ('k') | ui/views/cocoa/bridged_native_widget.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698