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

Side by Side 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/bind_helpers.h" 5 #include "base/bind_helpers.h"
6 #include "base/command_line.h" 6 #include "base/command_line.h"
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/message_loop/message_loop.h" 8 #include "base/message_loop/message_loop.h"
9 #include "content/browser/browser_plugin/browser_plugin_guest.h" 9 #include "content/browser/browser_plugin/browser_plugin_guest.h"
10 #include "content/browser/frame_host/render_widget_host_view_guest.h" 10 #include "content/browser/frame_host/render_widget_host_view_guest.h"
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 gesture_recognizer_->AddGestureEventHelper(this); 56 gesture_recognizer_->AddGestureEventHelper(this);
57 #endif // defined(USE_AURA) 57 #endif // defined(USE_AURA)
58 } 58 }
59 59
60 RenderWidgetHostViewGuest::~RenderWidgetHostViewGuest() { 60 RenderWidgetHostViewGuest::~RenderWidgetHostViewGuest() {
61 #if defined(USE_AURA) 61 #if defined(USE_AURA)
62 gesture_recognizer_->RemoveGestureEventHelper(this); 62 gesture_recognizer_->RemoveGestureEventHelper(this);
63 #endif // defined(USE_AURA) 63 #endif // defined(USE_AURA)
64 } 64 }
65 65
66 bool RenderWidgetHostViewGuest::OnMessageReceivedFromEmbedder(
67 const IPC::Message& message,
68 RenderWidgetHostImpl* embedder) {
69 bool handled = true;
70 IPC_BEGIN_MESSAGE_MAP_WITH_PARAM(RenderWidgetHostViewGuest, message,
71 embedder)
72 IPC_MESSAGE_HANDLER(BrowserPluginHostMsg_HandleInputEvent,
73 OnHandleInputEvent)
74 IPC_MESSAGE_UNHANDLED(handled = false)
75 IPC_END_MESSAGE_MAP()
76 return handled;
77 }
78
66 void RenderWidgetHostViewGuest::WasShown() { 79 void RenderWidgetHostViewGuest::WasShown() {
67 // If the WebContents associated with us showed an interstitial page in the 80 // If the WebContents associated with us showed an interstitial page in the
68 // beginning, the teardown path might call WasShown() while |host_| is in 81 // beginning, the teardown path might call WasShown() while |host_| is in
69 // the process of destruction. Avoid calling WasShown below in this case. 82 // the process of destruction. Avoid calling WasShown below in this case.
70 // TODO(lazyboy): We shouldn't be showing interstitial pages in guests in the 83 // TODO(lazyboy): We shouldn't be showing interstitial pages in guests in the
71 // first place: http://crbug.com/273089. 84 // first place: http://crbug.com/273089.
72 // 85 //
73 // |guest_| is NULL during test. 86 // |guest_| is NULL during test.
74 if ((guest_ && guest_->is_in_destruction()) || !host_->is_hidden()) 87 if ((guest_ && guest_->is_in_destruction()) || !host_->is_hidden())
75 return; 88 return;
(...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after
523 SkColorType RenderWidgetHostViewGuest::PreferredReadbackFormat() { 536 SkColorType RenderWidgetHostViewGuest::PreferredReadbackFormat() {
524 return kN32_SkColorType; 537 return kN32_SkColorType;
525 } 538 }
526 539
527 RenderWidgetHostViewBase* 540 RenderWidgetHostViewBase*
528 RenderWidgetHostViewGuest::GetGuestRenderWidgetHostView() const { 541 RenderWidgetHostViewGuest::GetGuestRenderWidgetHostView() const {
529 return static_cast<RenderWidgetHostViewBase*>( 542 return static_cast<RenderWidgetHostViewBase*>(
530 guest_->GetEmbedderRenderWidgetHostView()); 543 guest_->GetEmbedderRenderWidgetHostView());
531 } 544 }
532 545
546 void RenderWidgetHostViewGuest::OnHandleInputEvent(
547 RenderWidgetHostImpl* embedder,
548 int browser_plugin_instance_id,
549 const gfx::Rect& guest_window_rect,
550 const blink::WebInputEvent* event) {
551 if (blink::WebInputEvent::isMouseEventType(event->type)) {
552 host_->ForwardMouseEvent(
553 *static_cast<const blink::WebMouseEvent*>(event));
554 return;
555 }
556
557 if (event->type == blink::WebInputEvent::MouseWheel) {
558 host_->ForwardWheelEvent(
559 *static_cast<const blink::WebMouseWheelEvent*>(event));
560 return;
561 }
562
563 if (blink::WebInputEvent::isKeyboardEventType(event->type)) {
564 if (!embedder->GetLastKeyboardEvent())
565 return;
566 NativeWebKeyboardEvent keyboard_event(
567 *embedder->GetLastKeyboardEvent());
568 host_->ForwardKeyboardEvent(keyboard_event);
569 return;
570 }
571
572 if (blink::WebInputEvent::isTouchEventType(event->type)) {
573 host_->ForwardTouchEventWithLatencyInfo(
574 *static_cast<const blink::WebTouchEvent*>(event),
575 ui::LatencyInfo());
576 return;
577 }
578
579 if (blink::WebInputEvent::isGestureEventType(event->type)) {
580 host_->ForwardGestureEvent(
581 *static_cast<const blink::WebGestureEvent*>(event));
582 return;
583 }
584 }
585
533 } // namespace content 586 } // namespace content
OLDNEW
« 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