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

Unified Diff: content/browser/renderer_host/render_widget_host_impl.cc

Issue 23416003: Add content::RenderWidgetHost::MouseEventCallback (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased changes Created 7 years, 4 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: 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())
« no previous file with comments | « content/browser/renderer_host/render_widget_host_impl.h ('k') | content/browser/renderer_host/render_widget_host_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698