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

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: Added TODO 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
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 bool handled = true;
69 IPC_BEGIN_MESSAGE_MAP(RenderWidgetHostViewGuest, message)
70 IPC_MESSAGE_HANDLER(BrowserPluginHostMsg_HandleInputEvent,
71 OnHandleInputEvent)
Charlie Reis 2014/09/10 00:28:21 To pass the embedder_web_contents to the handler,
Fady Samuel 2014/09/10 02:51:37 Done.
72 IPC_MESSAGE_UNHANDLED(handled = false)
73 IPC_END_MESSAGE_MAP()
74 return handled;
75 }
76
66 void RenderWidgetHostViewGuest::WasShown() { 77 void RenderWidgetHostViewGuest::WasShown() {
67 // If the WebContents associated with us showed an interstitial page in the 78 // If the WebContents associated with us showed an interstitial page in the
68 // beginning, the teardown path might call WasShown() while |host_| is in 79 // beginning, the teardown path might call WasShown() while |host_| is in
69 // the process of destruction. Avoid calling WasShown below in this case. 80 // 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 81 // TODO(lazyboy): We shouldn't be showing interstitial pages in guests in the
71 // first place: http://crbug.com/273089. 82 // first place: http://crbug.com/273089.
72 // 83 //
73 // |guest_| is NULL during test. 84 // |guest_| is NULL during test.
74 if ((guest_ && guest_->is_in_destruction()) || !host_->is_hidden()) 85 if ((guest_ && guest_->is_in_destruction()) || !host_->is_hidden())
75 return; 86 return;
(...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after
523 SkColorType RenderWidgetHostViewGuest::PreferredReadbackFormat() { 534 SkColorType RenderWidgetHostViewGuest::PreferredReadbackFormat() {
524 return kN32_SkColorType; 535 return kN32_SkColorType;
525 } 536 }
526 537
527 RenderWidgetHostViewBase* 538 RenderWidgetHostViewBase*
528 RenderWidgetHostViewGuest::GetGuestRenderWidgetHostView() const { 539 RenderWidgetHostViewGuest::GetGuestRenderWidgetHostView() const {
529 return static_cast<RenderWidgetHostViewBase*>( 540 return static_cast<RenderWidgetHostViewBase*>(
530 guest_->GetEmbedderRenderWidgetHostView()); 541 guest_->GetEmbedderRenderWidgetHostView());
531 } 542 }
532 543
544 void RenderWidgetHostViewGuest::OnHandleInputEvent(
545 int browser_plugin_instance_id,
546 const gfx::Rect& guest_window_rect,
547 const blink::WebInputEvent* event) {
548 if (blink::WebInputEvent::isMouseEventType(event->type)) {
549 host_->ForwardMouseEvent(
550 *static_cast<const blink::WebMouseEvent*>(event));
551 return;
552 }
553
554 if (event->type == blink::WebInputEvent::MouseWheel) {
555 host_->ForwardWheelEvent(
556 *static_cast<const blink::WebMouseWheelEvent*>(event));
557 return;
558 }
559
560 if (blink::WebInputEvent::isKeyboardEventType(event->type)) {
561 RenderViewHostImpl* embedder_rvh = static_cast<RenderViewHostImpl*>(
562 guest_->embedder_web_contents()->GetRenderViewHost());
563 if (!embedder_rvh->GetLastKeyboardEvent())
564 return;
565 NativeWebKeyboardEvent keyboard_event(
566 *embedder_rvh->GetLastKeyboardEvent());
567 host_->ForwardKeyboardEvent(keyboard_event);
568 return;
569 }
570
571 if (blink::WebInputEvent::isTouchEventType(event->type)) {
572 host_->ForwardTouchEventWithLatencyInfo(
573 *static_cast<const blink::WebTouchEvent*>(event),
574 ui::LatencyInfo());
575 return;
576 }
577
578 if (blink::WebInputEvent::isGestureEventType(event->type)) {
579 host_->ForwardGestureEvent(
580 *static_cast<const blink::WebGestureEvent*>(event));
581 return;
582 }
583 }
584
533 } // namespace content 585 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698