OLD | NEW |
---|---|
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 533 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
544 } | 544 } |
545 } | 545 } |
546 | 546 |
547 void RenderWidgetHostViewGuest::GestureEventAck( | 547 void RenderWidgetHostViewGuest::GestureEventAck( |
548 const blink::WebGestureEvent& event, | 548 const blink::WebGestureEvent& event, |
549 InputEventAckState ack_result) { | 549 InputEventAckState ack_result) { |
550 bool not_consumed = ack_result == INPUT_EVENT_ACK_STATE_NOT_CONSUMED || | 550 bool not_consumed = ack_result == INPUT_EVENT_ACK_STATE_NOT_CONSUMED || |
551 ack_result == INPUT_EVENT_ACK_STATE_NO_CONSUMER_EXISTS; | 551 ack_result == INPUT_EVENT_ACK_STATE_NO_CONSUMER_EXISTS; |
552 // GestureScrollBegin/End are always consumed by the guest, so we only | 552 // GestureScrollBegin/End are always consumed by the guest, so we only |
553 // forward GestureScrollUpdate. | 553 // forward GestureScrollUpdate. |
554 // Consumed GestureScrollUpdates and GestureScrollBegins must still be | |
555 // forwarded to the owner RWHV so it may update its state. | |
554 if (event.GetType() == blink::WebInputEvent::kGestureScrollUpdate && | 556 if (event.GetType() == blink::WebInputEvent::kGestureScrollUpdate && |
555 not_consumed) | 557 not_consumed) |
556 guest_->ResendEventToEmbedder(event); | 558 guest_->ResendEventToEmbedder(event); |
559 else if (event.GetType() == blink::WebInputEvent::kGestureScrollUpdate || | |
Charlie Reis
2017/05/05 23:45:44
Style nit: I think it would improve readability to
Kevin McNee
2017/05/17 22:39:33
Done.
| |
560 event.GetType() == blink::WebInputEvent::kGestureScrollBegin) | |
561 GetOwnerRenderWidgetHostView()->GestureEventAck(event, ack_result); | |
562 } | |
563 | |
564 InputEventAckState RenderWidgetHostViewGuest::FilterInputEvent( | |
565 const blink::WebInputEvent& input_event) { | |
566 InputEventAckState ack_state = | |
567 RenderWidgetHostViewChildFrame::FilterInputEvent(input_event); | |
568 if (ack_state != INPUT_EVENT_ACK_STATE_NOT_CONSUMED) | |
569 return ack_state; | |
570 | |
571 // The owner RWHV may want to consume the guest's GestureScrollUpdates. | |
572 // Also, we don't resend GestureFlingStarts, GestureScrollBegins, or | |
573 // GestureScrollEnds, so we let the owner RWHV know about them here. | |
574 if (input_event.GetType() == blink::WebInputEvent::kGestureScrollUpdate || | |
575 input_event.GetType() == blink::WebInputEvent::kGestureFlingStart || | |
576 input_event.GetType() == blink::WebInputEvent::kGestureScrollBegin || | |
577 input_event.GetType() == blink::WebInputEvent::kGestureScrollEnd) { | |
578 const blink::WebGestureEvent& gesture_event = | |
579 static_cast<const blink::WebGestureEvent&>(input_event); | |
580 return GetOwnerRenderWidgetHostView()->FilterChildGestureEvent( | |
581 gesture_event); | |
582 } | |
583 | |
584 return INPUT_EVENT_ACK_STATE_NOT_CONSUMED; | |
557 } | 585 } |
558 | 586 |
559 bool RenderWidgetHostViewGuest::IsRenderWidgetHostViewGuest() { | 587 bool RenderWidgetHostViewGuest::IsRenderWidgetHostViewGuest() { |
560 return true; | 588 return true; |
561 } | 589 } |
562 | 590 |
563 void RenderWidgetHostViewGuest::OnHandleInputEvent( | 591 void RenderWidgetHostViewGuest::OnHandleInputEvent( |
564 RenderWidgetHostImpl* embedder, | 592 RenderWidgetHostImpl* embedder, |
565 int browser_plugin_instance_id, | 593 int browser_plugin_instance_id, |
566 const blink::WebInputEvent* event) { | 594 const blink::WebInputEvent* event) { |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
653 host_->ForwardGestureEvent(gesture_event); | 681 host_->ForwardGestureEvent(gesture_event); |
654 return; | 682 return; |
655 } | 683 } |
656 } | 684 } |
657 | 685 |
658 bool RenderWidgetHostViewGuest::HasEmbedderChanged() { | 686 bool RenderWidgetHostViewGuest::HasEmbedderChanged() { |
659 return guest_ && guest_->has_attached_since_surface_set(); | 687 return guest_ && guest_->has_attached_since_surface_set(); |
660 } | 688 } |
661 | 689 |
662 } // namespace content | 690 } // namespace content |
OLD | NEW |