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