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 |