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 "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 "cc/surfaces/surface.h" | 9 #include "cc/surfaces/surface.h" |
10 #include "cc/surfaces/surface_factory.h" | 10 #include "cc/surfaces/surface_factory.h" |
(...skipping 611 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
622 ForwardGestureEventToRenderer(*g_it); | 622 ForwardGestureEventToRenderer(*g_it); |
623 } | 623 } |
624 } | 624 } |
625 | 625 |
626 RenderWidgetHostViewBase* | 626 RenderWidgetHostViewBase* |
627 RenderWidgetHostViewGuest::GetOwnerRenderWidgetHostView() const { | 627 RenderWidgetHostViewGuest::GetOwnerRenderWidgetHostView() const { |
628 return static_cast<RenderWidgetHostViewBase*>( | 628 return static_cast<RenderWidgetHostViewBase*>( |
629 guest_->GetOwnerRenderWidgetHostView()); | 629 guest_->GetOwnerRenderWidgetHostView()); |
630 } | 630 } |
631 | 631 |
| 632 void RenderWidgetHostViewGuest::WheelEventAck( |
| 633 const blink::WebMouseWheelEvent& event, |
| 634 InputEventAckState ack_result) { |
| 635 if (ack_result == INPUT_EVENT_ACK_STATE_NOT_CONSUMED) |
| 636 guest_->ResendEventToEmbedder(event); |
| 637 } |
| 638 |
| 639 void RenderWidgetHostViewGuest::GestureEventAck( |
| 640 const blink::WebGestureEvent& event, |
| 641 InputEventAckState ack_result) { |
| 642 bool not_consumed = INPUT_EVENT_ACK_STATE_NOT_CONSUMED == ack_result; |
| 643 // GestureScrollBegin/End are always consumed by the guest, so we only |
| 644 // forward GestureScrollUpdate. |
| 645 if (event.type == blink::WebInputEvent::GestureScrollUpdate && not_consumed) |
| 646 guest_->ResendEventToEmbedder(event); |
| 647 } |
| 648 |
632 void RenderWidgetHostViewGuest::OnHandleInputEvent( | 649 void RenderWidgetHostViewGuest::OnHandleInputEvent( |
633 RenderWidgetHostImpl* embedder, | 650 RenderWidgetHostImpl* embedder, |
634 int browser_plugin_instance_id, | 651 int browser_plugin_instance_id, |
635 const gfx::Rect& guest_window_rect, | 652 const gfx::Rect& guest_window_rect, |
636 const blink::WebInputEvent* event) { | 653 const blink::WebInputEvent* event) { |
637 if (blink::WebInputEvent::isMouseEventType(event->type)) { | 654 if (blink::WebInputEvent::isMouseEventType(event->type)) { |
638 // The mouse events for BrowserPlugin are modified by all | 655 // The mouse events for BrowserPlugin are modified by all |
639 // the CSS transforms applied on the <object> and embedder. As a result of | 656 // the CSS transforms applied on the <object> and embedder. As a result of |
640 // this, the coordinates passed on to the guest renderer are potentially | 657 // this, the coordinates passed on to the guest renderer are potentially |
641 // incorrect to determine the position of the context menu(they are not the | 658 // incorrect to determine the position of the context menu(they are not the |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
676 embedder->GetView()->Focus(); | 693 embedder->GetView()->Focus(); |
677 } | 694 } |
678 | 695 |
679 host_->ForwardTouchEventWithLatencyInfo( | 696 host_->ForwardTouchEventWithLatencyInfo( |
680 *static_cast<const blink::WebTouchEvent*>(event), | 697 *static_cast<const blink::WebTouchEvent*>(event), |
681 ui::LatencyInfo()); | 698 ui::LatencyInfo()); |
682 return; | 699 return; |
683 } | 700 } |
684 | 701 |
685 if (blink::WebInputEvent::isGestureEventType(event->type)) { | 702 if (blink::WebInputEvent::isGestureEventType(event->type)) { |
686 host_->ForwardGestureEvent( | 703 const blink::WebGestureEvent& gesture_event = |
687 *static_cast<const blink::WebGestureEvent*>(event)); | 704 *static_cast<const blink::WebGestureEvent*>(event); |
| 705 |
| 706 // We don't forward inertial GestureScrollUpdates to the guest anymore |
| 707 // since it now receives GestureFlingStart and will have its own fling |
| 708 // curve generating GestureScrollUpdate events for it. |
| 709 // TODO(wjmaclean): Should we try to avoid creating a fling curve in the |
| 710 // embedder renderer in this case? BrowserPlugin can return 'true' for |
| 711 // handleInputEvent() on a GestureFlingStart, and we could use this as |
| 712 // a signal to let the guest handle the fling, though we'd need to be |
| 713 // sure other plugins would behave appropriately (i.e. return 'false'). |
| 714 if (gesture_event.type == blink::WebInputEvent::GestureScrollUpdate && |
| 715 gesture_event.data.scrollUpdate.inertial) { |
| 716 return; |
| 717 } |
| 718 host_->ForwardGestureEvent(gesture_event); |
688 return; | 719 return; |
689 } | 720 } |
690 } | 721 } |
691 | 722 |
692 } // namespace content | 723 } // namespace content |
OLD | NEW |