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

Unified Diff: ui/views/cocoa/bridged_content_view.mm

Issue 322893005: MacViews: Add WidgetEventGenerator to abstract platform-specific event generation for tests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: cull orthogonal stuff, add WidgetTest.MouseEventTypesViaGenerator Created 6 years, 6 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: ui/views/cocoa/bridged_content_view.mm
diff --git a/ui/views/cocoa/bridged_content_view.mm b/ui/views/cocoa/bridged_content_view.mm
index bd9a511a24468e0b4901e9f184bcb5e6217e8919..fda514016bf89e228e0b7ea3c044b6b6e1a5d5d3 100644
--- a/ui/views/cocoa/bridged_content_view.mm
+++ b/ui/views/cocoa/bridged_content_view.mm
@@ -7,6 +7,15 @@
#include "base/logging.h"
#include "ui/gfx/canvas_paint_mac.h"
#include "ui/views/view.h"
+#include "ui/views/widget/widget.h"
+
+@interface BridgedContentView ()
+
+// Translates the location of |theEvent| to toolkit-views coordinates and passes
+// the event to NativeWidgetMac for handling.
+- (void)handleMouseEvent:(NSEvent*)theEvent;
+
+@end
@implementation BridgedContentView
@@ -29,6 +38,16 @@
hostedView_ = NULL;
}
+// BridgedContentView private implementation.
+
+- (void)handleMouseEvent:(NSEvent*)theEvent {
+ if (!hostedView_)
+ return;
+
+ ui::MouseEvent event(theEvent);
+ hostedView_->GetWidget()->OnMouseEvent(&event);
+}
+
// NSView implementation.
- (void)setFrameSize:(NSSize)newSize {
@@ -47,4 +66,56 @@
hostedView_->Paint(&canvas, views::CullSet());
}
+- (void)mouseDown:(NSEvent*)theEvent {
+ [self handleMouseEvent:theEvent];
+}
+
+- (void)rightMouseDown:(NSEvent*)theEvent {
+ [self handleMouseEvent:theEvent];
+}
+
+- (void)otherMouseDown:(NSEvent*)theEvent {
+ [self handleMouseEvent:theEvent];
+}
+
+- (void)mouseUp:(NSEvent*)theEvent {
+ [self handleMouseEvent:theEvent];
+}
+
+- (void)rightMouseUp:(NSEvent*)theEvent {
+ [self handleMouseEvent:theEvent];
+}
+
+- (void)otherMouseUp:(NSEvent*)theEvent {
+ [self handleMouseEvent:theEvent];
+}
+
+- (void)mouseDragged:(NSEvent*)theEvent {
+ [self handleMouseEvent:theEvent];
+}
+
+- (void)rightMouseDragged:(NSEvent*)theEvent {
+ [self handleMouseEvent:theEvent];
+}
+
+- (void)otherMouseDragged:(NSEvent*)theEvent {
+ [self handleMouseEvent:theEvent];
+}
+
+- (void)mouseMoved:(NSEvent*)theEvent {
+ [self handleMouseEvent:theEvent];
+}
+
+- (void)scrollWheel:(NSEvent*)theEvent {
+ [self handleMouseEvent:theEvent];
+}
+
+- (void)mouseEntered:(NSEvent*)theEvent {
+ [self handleMouseEvent:theEvent];
+}
+
+- (void)mouseExited:(NSEvent*)theEvent {
+ [self handleMouseEvent:theEvent];
+}
+
@end

Powered by Google App Engine
This is Rietveld 408576698