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

Side by Side Diff: content/browser/frame_host/render_widget_host_view_guest.cc

Issue 2815823003: Notify OverscrollController of gesture events in plugins. (Closed)
Patch Set: Rebase. Created 3 years, 7 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 "content/browser/frame_host/render_widget_host_view_guest.h" 5 #include "content/browser/frame_host/render_widget_host_view_guest.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind_helpers.h" 9 #include "base/bind_helpers.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 536 matching lines...) Expand 10 before | Expand all | Expand 10 after
547 } 547 }
548 } 548 }
549 549
550 void RenderWidgetHostViewGuest::GestureEventAck( 550 void RenderWidgetHostViewGuest::GestureEventAck(
551 const blink::WebGestureEvent& event, 551 const blink::WebGestureEvent& event,
552 InputEventAckState ack_result) { 552 InputEventAckState ack_result) {
553 bool not_consumed = ack_result == INPUT_EVENT_ACK_STATE_NOT_CONSUMED || 553 bool not_consumed = ack_result == INPUT_EVENT_ACK_STATE_NOT_CONSUMED ||
554 ack_result == INPUT_EVENT_ACK_STATE_NO_CONSUMER_EXISTS; 554 ack_result == INPUT_EVENT_ACK_STATE_NO_CONSUMER_EXISTS;
555 // GestureScrollBegin/End are always consumed by the guest, so we only 555 // GestureScrollBegin/End are always consumed by the guest, so we only
556 // forward GestureScrollUpdate. 556 // forward GestureScrollUpdate.
557 // Consumed GestureScrollUpdates and GestureScrollBegins must still be
558 // forwarded to the owner RWHV so it may update its state.
557 if (event.GetType() == blink::WebInputEvent::kGestureScrollUpdate && 559 if (event.GetType() == blink::WebInputEvent::kGestureScrollUpdate &&
558 not_consumed) 560 not_consumed) {
559 guest_->ResendEventToEmbedder(event); 561 guest_->ResendEventToEmbedder(event);
562 } else if (event.GetType() == blink::WebInputEvent::kGestureScrollUpdate ||
563 event.GetType() == blink::WebInputEvent::kGestureScrollBegin) {
564 GetOwnerRenderWidgetHostView()->GestureEventAck(event, ack_result);
565 }
566 }
567
568 InputEventAckState RenderWidgetHostViewGuest::FilterInputEvent(
569 const blink::WebInputEvent& input_event) {
570 InputEventAckState ack_state =
571 RenderWidgetHostViewChildFrame::FilterInputEvent(input_event);
572 if (ack_state != INPUT_EVENT_ACK_STATE_NOT_CONSUMED)
573 return ack_state;
574
575 // The owner RWHV may want to consume the guest's GestureScrollUpdates.
576 // Also, we don't resend GestureFlingStarts, GestureScrollBegins, or
577 // GestureScrollEnds, so we let the owner RWHV know about them here.
578 if (input_event.GetType() == blink::WebInputEvent::kGestureScrollUpdate ||
579 input_event.GetType() == blink::WebInputEvent::kGestureFlingStart ||
580 input_event.GetType() == blink::WebInputEvent::kGestureScrollBegin ||
581 input_event.GetType() == blink::WebInputEvent::kGestureScrollEnd) {
582 const blink::WebGestureEvent& gesture_event =
583 static_cast<const blink::WebGestureEvent&>(input_event);
584 return GetOwnerRenderWidgetHostView()->FilterChildGestureEvent(
585 gesture_event);
586 }
587
588 return INPUT_EVENT_ACK_STATE_NOT_CONSUMED;
560 } 589 }
561 590
562 bool RenderWidgetHostViewGuest::IsRenderWidgetHostViewGuest() { 591 bool RenderWidgetHostViewGuest::IsRenderWidgetHostViewGuest() {
563 return true; 592 return true;
564 } 593 }
565 594
566 void RenderWidgetHostViewGuest::OnHandleInputEvent( 595 void RenderWidgetHostViewGuest::OnHandleInputEvent(
567 RenderWidgetHostImpl* embedder, 596 RenderWidgetHostImpl* embedder,
568 int browser_plugin_instance_id, 597 int browser_plugin_instance_id,
569 const blink::WebInputEvent* event) { 598 const blink::WebInputEvent* event) {
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
656 host_->ForwardGestureEvent(gesture_event); 685 host_->ForwardGestureEvent(gesture_event);
657 return; 686 return;
658 } 687 }
659 } 688 }
660 689
661 bool RenderWidgetHostViewGuest::HasEmbedderChanged() { 690 bool RenderWidgetHostViewGuest::HasEmbedderChanged() {
662 return guest_ && guest_->has_attached_since_surface_set(); 691 return guest_ && guest_->has_attached_since_surface_set();
663 } 692 }
664 693
665 } // namespace content 694 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/frame_host/render_widget_host_view_guest.h ('k') | content/browser/renderer_host/overscroll_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698