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

Unified Diff: content/browser/frame_host/render_widget_host_view_guest.cc

Issue 554733003: Browser Plugin: Move input to RWHVGuest to support interstitial pages (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@remove_to_guest_rect
Patch Set: Pass in RenderWidgetHostImpl instead of WebContents Created 6 years, 3 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
« no previous file with comments | « content/browser/frame_host/render_widget_host_view_guest.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/frame_host/render_widget_host_view_guest.cc
diff --git a/content/browser/frame_host/render_widget_host_view_guest.cc b/content/browser/frame_host/render_widget_host_view_guest.cc
index 024e48fa30720e3dec7487dd905732f54191ef88..7aa5b21148e40076aca06e7c744b7e898179770e 100644
--- a/content/browser/frame_host/render_widget_host_view_guest.cc
+++ b/content/browser/frame_host/render_widget_host_view_guest.cc
@@ -63,6 +63,19 @@ RenderWidgetHostViewGuest::~RenderWidgetHostViewGuest() {
#endif // defined(USE_AURA)
}
+bool RenderWidgetHostViewGuest::OnMessageReceivedFromEmbedder(
+ const IPC::Message& message,
+ RenderWidgetHostImpl* embedder) {
+ bool handled = true;
+ IPC_BEGIN_MESSAGE_MAP_WITH_PARAM(RenderWidgetHostViewGuest, message,
+ embedder)
+ IPC_MESSAGE_HANDLER(BrowserPluginHostMsg_HandleInputEvent,
+ OnHandleInputEvent)
+ IPC_MESSAGE_UNHANDLED(handled = false)
+ IPC_END_MESSAGE_MAP()
+ return handled;
+}
+
void RenderWidgetHostViewGuest::WasShown() {
// If the WebContents associated with us showed an interstitial page in the
// beginning, the teardown path might call WasShown() while |host_| is in
@@ -530,4 +543,44 @@ RenderWidgetHostViewGuest::GetGuestRenderWidgetHostView() const {
guest_->GetEmbedderRenderWidgetHostView());
}
+void RenderWidgetHostViewGuest::OnHandleInputEvent(
+ RenderWidgetHostImpl* embedder,
+ int browser_plugin_instance_id,
+ const gfx::Rect& guest_window_rect,
+ const blink::WebInputEvent* event) {
+ if (blink::WebInputEvent::isMouseEventType(event->type)) {
+ host_->ForwardMouseEvent(
+ *static_cast<const blink::WebMouseEvent*>(event));
+ return;
+ }
+
+ if (event->type == blink::WebInputEvent::MouseWheel) {
+ host_->ForwardWheelEvent(
+ *static_cast<const blink::WebMouseWheelEvent*>(event));
+ return;
+ }
+
+ if (blink::WebInputEvent::isKeyboardEventType(event->type)) {
+ if (!embedder->GetLastKeyboardEvent())
+ return;
+ NativeWebKeyboardEvent keyboard_event(
+ *embedder->GetLastKeyboardEvent());
+ host_->ForwardKeyboardEvent(keyboard_event);
+ return;
+ }
+
+ if (blink::WebInputEvent::isTouchEventType(event->type)) {
+ host_->ForwardTouchEventWithLatencyInfo(
+ *static_cast<const blink::WebTouchEvent*>(event),
+ ui::LatencyInfo());
+ return;
+ }
+
+ if (blink::WebInputEvent::isGestureEventType(event->type)) {
+ host_->ForwardGestureEvent(
+ *static_cast<const blink::WebGestureEvent*>(event));
+ return;
+ }
+}
+
} // namespace content
« no previous file with comments | « content/browser/frame_host/render_widget_host_view_guest.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698