summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authoravi@chromium.org <avi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-02-12 20:58:46 +0000
committeravi@chromium.org <avi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-02-12 20:58:46 +0000
commitef77dc138e27f5f143589a4c27ca760e0ac2d079 (patch)
treeec74891830751da7980641ac99d9ebd58d00ad6c /chrome
parentd48f1e0c85c0fda7e02a9f5d6e99740cc37b47b9 (diff)
downloadchromium_src-ef77dc138e27f5f143589a4c27ca760e0ac2d079.zip
chromium_src-ef77dc138e27f5f143589a4c27ca760e0ac2d079.tar.gz
chromium_src-ef77dc138e27f5f143589a4c27ca760e0ac2d079.tar.bz2
Pump events to the renderer. Doesn't work currently due to activation issues.
Review URL: http://codereview.chromium.org/21306 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@9702 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/cocoa/event_view.h25
-rw-r--r--chrome/browser/cocoa/event_view.mm99
-rw-r--r--chrome/browser/renderer_host/render_widget_host_view_mac.h3
-rw-r--r--chrome/browser/renderer_host/render_widget_host_view_mac.mm18
-rw-r--r--chrome/chrome.xcodeproj/project.pbxproj14
5 files changed, 153 insertions, 6 deletions
diff --git a/chrome/browser/cocoa/event_view.h b/chrome/browser/cocoa/event_view.h
new file mode 100644
index 0000000..fc49232
--- /dev/null
+++ b/chrome/browser/cocoa/event_view.h
@@ -0,0 +1,25 @@
+// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_COCOA_EVENT_VIEW_H_
+#define CHROME_BROWSER_COCOA_EVENT_VIEW_H_
+
+#import <Cocoa/Cocoa.h>
+
+// A view that registers for mouse move events, and funnels all events.
+
+@interface EventView : NSView {
+ @private
+ NSTrackingArea *trackingArea_;
+}
+
+- (id)initWithFrame:(NSRect)frame;
+
+// Override these methods in a subclass.
+- (void)mouseEvent:(NSEvent *)theEvent;
+- (void)keyEvent:(NSEvent *)theEvent;
+
+@end
+
+#endif // CHROME_BROWSER_COCOA_EVENT_VIEW_H_
diff --git a/chrome/browser/cocoa/event_view.mm b/chrome/browser/cocoa/event_view.mm
new file mode 100644
index 0000000..3cb4c44
--- /dev/null
+++ b/chrome/browser/cocoa/event_view.mm
@@ -0,0 +1,99 @@
+// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/cocoa/event_view.h"
+
+@implementation EventView
+
+- (id)initWithFrame:(NSRect)frame {
+ self = [super initWithFrame:frame];
+ if (self) {
+ trackingArea_ =
+ [[NSTrackingArea alloc] initWithRect:frame
+ options:NSTrackingMouseMoved |
+ NSTrackingActiveInActiveApp |
+ NSTrackingInVisibleRect
+ owner:self
+ userInfo:nil];
+ [self addTrackingArea:trackingArea_];
+ }
+ return self;
+}
+
+- (void)dealloc {
+ [self removeTrackingArea:trackingArea_];
+ [trackingArea_ release];
+
+ [super dealloc];
+}
+
+- (void)mouseEvent:(NSEvent *)theEvent {
+ // This method left intentionally blank.
+}
+
+- (void)keyEvent:(NSEvent *)theEvent {
+ // This method left intentionally blank.
+}
+
+- (void)mouseDown:(NSEvent *)theEvent {
+ [self mouseEvent:theEvent];
+}
+
+- (void)rightMouseDown:(NSEvent *)theEvent {
+ [self mouseEvent:theEvent];
+}
+
+- (void)otherMouseDown:(NSEvent *)theEvent {
+ [self mouseEvent:theEvent];
+}
+
+- (void)mouseUp:(NSEvent *)theEvent {
+ [self mouseEvent:theEvent];
+}
+
+- (void)rightMouseUp:(NSEvent *)theEvent {
+ [self mouseEvent:theEvent];
+}
+
+- (void)otherMouseUp:(NSEvent *)theEvent {
+ [self mouseEvent:theEvent];
+}
+
+- (void)mouseMoved:(NSEvent *)theEvent {
+ [self mouseEvent:theEvent];
+}
+
+- (void)mouseDragged:(NSEvent *)theEvent {
+ [self mouseEvent:theEvent];
+}
+
+- (void)rightMouseDragged:(NSEvent *)theEvent {
+ [self mouseEvent:theEvent];
+}
+
+- (void)otherMouseDragged:(NSEvent *)theEvent {
+ [self mouseEvent:theEvent];
+}
+
+- (void)mouseEntered:(NSEvent *)theEvent {
+ [self mouseEvent:theEvent];
+}
+
+- (void)mouseExited:(NSEvent *)theEvent {
+ [self mouseEvent:theEvent];
+}
+
+- (void)keyDown:(NSEvent *)theEvent {
+ [self keyEvent:theEvent];
+}
+
+- (void)keyUp:(NSEvent *)theEvent {
+ [self keyEvent:theEvent];
+}
+
+- (BOOL)isOpaque {
+ return YES;
+}
+
+@end
diff --git a/chrome/browser/renderer_host/render_widget_host_view_mac.h b/chrome/browser/renderer_host/render_widget_host_view_mac.h
index 398c411..073573d 100644
--- a/chrome/browser/renderer_host/render_widget_host_view_mac.h
+++ b/chrome/browser/renderer_host/render_widget_host_view_mac.h
@@ -8,6 +8,7 @@
#import <Cocoa/Cocoa.h>
#include "base/time.h"
+#include "chrome/browser/cocoa/event_view.h"
#include "chrome/browser/renderer_host/render_widget_host_view.h"
#include "webkit/glue/webcursor.h"
@@ -18,7 +19,7 @@ class RenderWidgetHostViewMac;
// but that means that the view needs to own the delegate and will dispose of it
// when it's removed from the view system.
-@interface RenderWidgetHostViewCocoa : NSView {
+@interface RenderWidgetHostViewCocoa : EventView {
@private
RenderWidgetHostViewMac* renderWidgetHostView_;
}
diff --git a/chrome/browser/renderer_host/render_widget_host_view_mac.mm b/chrome/browser/renderer_host/render_widget_host_view_mac.mm
index dd2066a..6dc179f 100644
--- a/chrome/browser/renderer_host/render_widget_host_view_mac.mm
+++ b/chrome/browser/renderer_host/render_widget_host_view_mac.mm
@@ -11,6 +11,7 @@
#include "chrome/browser/renderer_host/render_process_host.h"
#include "chrome/browser/renderer_host/render_widget_host.h"
#include "skia/ext/platform_canvas.h"
+#include "webkit/glue/webinputevent.h"
@interface RenderWidgetHostViewCocoa (Private)
- (id)initWithRenderWidgetHostViewMac:(RenderWidgetHostViewMac*)r;
@@ -215,7 +216,7 @@ void RenderWidgetHostViewMac::ShutdownHost() {
// them into the C++ system. TODO(avi): all that jazz
- (id)initWithRenderWidgetHostViewMac:(RenderWidgetHostViewMac*)r {
- self = [super init];
+ self = [super initWithFrame:NSZeroRect];
if (self != nil) {
renderWidgetHostView_ = r;
}
@@ -228,6 +229,21 @@ void RenderWidgetHostViewMac::ShutdownHost() {
[super dealloc];
}
+- (void)mouseEvent:(NSEvent *)theEvent {
+ WebMouseEvent event(theEvent, self);
+ renderWidgetHostView_->render_widget_host()->ForwardMouseEvent(event);
+}
+
+- (void)keyEvent:(NSEvent *)theEvent {
+ WebKeyboardEvent event(theEvent);
+ renderWidgetHostView_->render_widget_host()->ForwardKeyboardEvent(event);
+}
+
+- (void)scrollWheel:(NSEvent *)theEvent {
+ WebMouseWheelEvent event(theEvent, self);
+ renderWidgetHostView_->render_widget_host()->ForwardWheelEvent(event);
+}
+
- (void)drawRect:(NSRect)dirtyRect {
DCHECK(renderWidgetHostView_->render_widget_host()->process()->channel());
diff --git a/chrome/chrome.xcodeproj/project.pbxproj b/chrome/chrome.xcodeproj/project.pbxproj
index 5d4b05b..addf9b3 100644
--- a/chrome/chrome.xcodeproj/project.pbxproj
+++ b/chrome/chrome.xcodeproj/project.pbxproj
@@ -274,6 +274,7 @@
826858470F325A10009F6555 /* template_url_unittest.cc in Sources */ = {isa = PBXBuildFile; fileRef = B5D16EE60F21455600861FAC /* template_url_unittest.cc */; };
8268589C0F326CCC009F6555 /* template_url_parser_unittest.cc in Sources */ = {isa = PBXBuildFile; fileRef = B5D16EE20F21455600861FAC /* template_url_parser_unittest.cc */; };
826858FA0F326FA3009F6555 /* testing_profile.cc in Sources */ = {isa = PBXBuildFile; fileRef = 826858F80F326FA3009F6555 /* testing_profile.cc */; };
+ 82BB330A0F44B57C00761F43 /* event_view.mm in Sources */ = {isa = PBXBuildFile; fileRef = 82BB33090F44B57C00761F43 /* event_view.mm */; };
82FA32330F3A4CC400271C5A /* web_contents_view.cc in Sources */ = {isa = PBXBuildFile; fileRef = B6CCB9F20F1EC32700106F0D /* web_contents_view.cc */; };
82FA32760F3A537C00271C5A /* web_contents_view_mac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 82FA32750F3A537C00271C5A /* web_contents_view_mac.mm */; };
82FA33460F3A7F6900271C5A /* render_widget_host_view_mac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 82FA33450F3A7F6900271C5A /* render_widget_host_view_mac.mm */; };
@@ -2389,6 +2390,8 @@
826850600F2FCC27009F6555 /* libxslt.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = libxslt.xcodeproj; path = third_party/libxslt/libxslt.xcodeproj; sourceTree = "<group>"; };
826858F80F326FA3009F6555 /* testing_profile.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = testing_profile.cc; sourceTree = "<group>"; };
826858F90F326FA3009F6555 /* testing_profile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = testing_profile.h; sourceTree = "<group>"; };
+ 82BB33080F44B57C00761F43 /* event_view.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = event_view.h; path = cocoa/event_view.h; sourceTree = "<group>"; };
+ 82BB33090F44B57C00761F43 /* event_view.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = event_view.mm; path = cocoa/event_view.mm; sourceTree = "<group>"; };
82FA32740F3A537C00271C5A /* web_contents_view_mac.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = web_contents_view_mac.h; path = tab_contents/web_contents_view_mac.h; sourceTree = "<group>"; };
82FA32750F3A537C00271C5A /* web_contents_view_mac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = web_contents_view_mac.mm; path = tab_contents/web_contents_view_mac.mm; sourceTree = "<group>"; };
82FA33440F3A7F6900271C5A /* render_widget_host_view_mac.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = render_widget_host_view_mac.h; path = renderer_host/render_widget_host_view_mac.h; sourceTree = "<group>"; };
@@ -4317,6 +4320,8 @@
E46C50D10F292E9B00B393B8 /* cocoa */ = {
isa = PBXGroup;
children = (
+ 82BB33080F44B57C00761F43 /* event_view.h */,
+ 82BB33090F44B57C00761F43 /* event_view.mm */,
A7CBAD370F322A7E00360BF5 /* shell_dialogs_mac.mm */,
E46C50D70F292EAA00B393B8 /* tab_cell.h */,
E46C50D80F292EAA00B393B8 /* tab_cell.mm */,
@@ -5318,10 +5323,15 @@
E46C4ED40F27A94100B393B8 /* command_updater.cc in Sources */,
4D7BF9970E9D4863009A6919 /* cross_site_request_manager.cc in Sources */,
BAC2B8AD0F436C7F0063A33E /* cross_site_resource_handler.cc in Sources */,
+ 844EA0870F3E0C3B00B0EF26 /* debugger_host_impl.cpp in Sources */,
+ 844EA0880F3E0C4500B0EF26 /* debugger_io_socket.cc in Sources */,
+ 844EA08D0F3E0C5000B0EF26 /* debugger_node.cc in Sources */,
+ 844EA08E0F3E0C5900B0EF26 /* debugger_wrapper.cc in Sources */,
4D7BFA7C0E9D4994009A6919 /* dns_host_info.cc in Sources */,
E4F324550EE5CFB1002533CE /* download_database.cc in Sources */,
E43A77170F16616E00ABD5D1 /* download_resource_handler.cc in Sources */,
E45075E30F150A6F003BE099 /* download_throttling_resource_handler.cc in Sources */,
+ 82BB330A0F44B57C00761F43 /* event_view.mm in Sources */,
E4F324470EE5CF1F002533CE /* expire_history_backend.cc in Sources */,
E4F324430EE5CE94002533CE /* extension.cc in Sources */,
E48B6C280F2783E9002E47EC /* extension_protocols.cc in Sources */,
@@ -5427,10 +5437,6 @@
82FA32760F3A537C00271C5A /* web_contents_view_mac.mm in Sources */,
E48B6C3C0F27844F002E47EC /* web_data_service.cc in Sources */,
E45076200F150E0C003BE099 /* web_database.cc in Sources */,
- 844EA0870F3E0C3B00B0EF26 /* debugger_host_impl.cpp in Sources */,
- 844EA0880F3E0C4500B0EF26 /* debugger_io_socket.cc in Sources */,
- 844EA08D0F3E0C5000B0EF26 /* debugger_node.cc in Sources */,
- 844EA08E0F3E0C5900B0EF26 /* debugger_wrapper.cc in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};