Index: content/browser/renderer_host/render_widget_host_impl.cc |
diff --git a/content/browser/renderer_host/render_widget_host_impl.cc b/content/browser/renderer_host/render_widget_host_impl.cc |
index 7f9a7895e279ea6534a1f9c51605e82e92f860d8..d7e5479b24166de3d073b8a9135f5161a9bf1a46 100644 |
--- a/content/browser/renderer_host/render_widget_host_impl.cc |
+++ b/content/browser/renderer_host/render_widget_host_impl.cc |
@@ -1016,6 +1016,12 @@ void RenderWidgetHostImpl::ForwardMouseEventWithLatencyInfo( |
const MouseEventWithLatencyInfo& mouse_event) { |
TRACE_EVENT2("input", "RenderWidgetHostImpl::ForwardMouseEvent", |
"x", mouse_event.event.x, "y", mouse_event.event.y); |
+ |
+ for (size_t i = 0; i < mouse_event_callbacks_.size(); ++i) { |
+ if (mouse_event_callbacks_[i].Run(mouse_event.event)) |
+ return; |
+ } |
+ |
input_router_->SendMouseEvent(mouse_event); |
} |
@@ -1139,6 +1145,21 @@ void RenderWidgetHostImpl::RemoveKeyPressEventCallback( |
} |
} |
+void RenderWidgetHostImpl::AddMouseEventCallback( |
+ const MouseEventCallback& callback) { |
+ mouse_event_callbacks_.push_back(callback); |
+} |
+ |
+void RenderWidgetHostImpl::RemoveMouseEventCallback( |
+ const MouseEventCallback& callback) { |
+ for (size_t i = 0; i < mouse_event_callbacks_.size(); ++i) { |
+ if (mouse_event_callbacks_[i].Equals(callback)) { |
+ mouse_event_callbacks_.erase(mouse_event_callbacks_.begin() + i); |
+ return; |
+ } |
+ } |
+} |
+ |
void RenderWidgetHostImpl::GetWebScreenInfo(WebKit::WebScreenInfo* result) { |
TRACE_EVENT0("renderer_host", "RenderWidgetHostImpl::GetWebScreenInfo"); |
if (GetView()) |