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 13 matching lines...) Expand all Loading... |
24 #include "content/browser/renderer_host/render_widget_host_input_event_router.h" | 24 #include "content/browser/renderer_host/render_widget_host_input_event_router.h" |
25 #include "content/common/browser_plugin/browser_plugin_messages.h" | 25 #include "content/common/browser_plugin/browser_plugin_messages.h" |
26 #include "content/common/content_switches_internal.h" | 26 #include "content/common/content_switches_internal.h" |
27 #include "content/common/frame_messages.h" | 27 #include "content/common/frame_messages.h" |
28 #include "content/common/input/web_touch_event_traits.h" | 28 #include "content/common/input/web_touch_event_traits.h" |
29 #include "content/common/site_isolation_policy.h" | 29 #include "content/common/site_isolation_policy.h" |
30 #include "content/common/view_messages.h" | 30 #include "content/common/view_messages.h" |
31 #include "content/public/common/content_switches.h" | 31 #include "content/public/common/content_switches.h" |
32 #include "gpu/ipc/common/gpu_messages.h" | 32 #include "gpu/ipc/common/gpu_messages.h" |
33 #include "skia/ext/platform_canvas.h" | 33 #include "skia/ext/platform_canvas.h" |
| 34 #include "ui/events/base_event_utils.h" |
34 | 35 |
35 #if defined(OS_MACOSX) | 36 #if defined(OS_MACOSX) |
36 #import "content/browser/renderer_host/render_widget_host_view_mac_dictionary_he
lper.h" | 37 #import "content/browser/renderer_host/render_widget_host_view_mac_dictionary_he
lper.h" |
37 #endif | 38 #endif |
38 | 39 |
39 #if defined(USE_AURA) | 40 #if defined(USE_AURA) |
40 #include "content/browser/renderer_host/ui_events_helper.h" | 41 #include "content/browser/renderer_host/ui_events_helper.h" |
41 #endif | 42 #endif |
42 | 43 |
43 namespace content { | 44 namespace content { |
(...skipping 512 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
556 const blink::WebFloatPoint& screenPosition) const { | 557 const blink::WebFloatPoint& screenPosition) const { |
557 if (!HasFocus()) { | 558 if (!HasFocus()) { |
558 // We need to a account for the position of the guest view within the | 559 // We need to a account for the position of the guest view within the |
559 // embedder, as well as the fact that the embedder's host will add its | 560 // embedder, as well as the fact that the embedder's host will add its |
560 // offset in screen coordinates before sending the event (with the latter | 561 // offset in screen coordinates before sending the event (with the latter |
561 // component just serving to confuse the renderer, hence why it should be | 562 // component just serving to confuse the renderer, hence why it should be |
562 // removed). | 563 // removed). |
563 gfx::Vector2d offset = | 564 gfx::Vector2d offset = |
564 GetViewBounds().origin() - | 565 GetViewBounds().origin() - |
565 GetOwnerRenderWidgetHostView()->GetBoundsInRootWindow().origin(); | 566 GetOwnerRenderWidgetHostView()->GetBoundsInRootWindow().origin(); |
566 blink::WebGestureEvent gesture_tap_event; | 567 blink::WebGestureEvent gesture_tap_event( |
| 568 blink::WebGestureEvent::GestureTapDown, |
| 569 blink::WebInputEvent::NoModifiers, |
| 570 ui::EventTimeStampToSeconds(ui::EventTimeForNow())); |
567 gesture_tap_event.sourceDevice = blink::WebGestureDeviceTouchscreen; | 571 gesture_tap_event.sourceDevice = blink::WebGestureDeviceTouchscreen; |
568 gesture_tap_event.type = blink::WebGestureEvent::GestureTapDown; | |
569 gesture_tap_event.x = position.x + offset.x(); | 572 gesture_tap_event.x = position.x + offset.x(); |
570 gesture_tap_event.y = position.y + offset.y(); | 573 gesture_tap_event.y = position.y + offset.y(); |
571 gesture_tap_event.globalX = screenPosition.x; | 574 gesture_tap_event.globalX = screenPosition.x; |
572 gesture_tap_event.globalY = screenPosition.y; | 575 gesture_tap_event.globalY = screenPosition.y; |
573 GetOwnerRenderWidgetHostView()->ProcessGestureEvent( | 576 GetOwnerRenderWidgetHostView()->ProcessGestureEvent( |
574 gesture_tap_event, ui::LatencyInfo(ui::SourceEventType::TOUCH)); | 577 gesture_tap_event, ui::LatencyInfo(ui::SourceEventType::TOUCH)); |
575 gesture_tap_event.type = blink::WebGestureEvent::GestureTapCancel; | 578 |
| 579 gesture_tap_event.setType(blink::WebGestureEvent::GestureTapCancel); |
576 GetOwnerRenderWidgetHostView()->ProcessGestureEvent( | 580 GetOwnerRenderWidgetHostView()->ProcessGestureEvent( |
577 gesture_tap_event, ui::LatencyInfo(ui::SourceEventType::TOUCH)); | 581 gesture_tap_event, ui::LatencyInfo(ui::SourceEventType::TOUCH)); |
578 } | 582 } |
579 } | 583 } |
580 | 584 |
581 void RenderWidgetHostViewGuest::WheelEventAck( | 585 void RenderWidgetHostViewGuest::WheelEventAck( |
582 const blink::WebMouseWheelEvent& event, | 586 const blink::WebMouseWheelEvent& event, |
583 InputEventAckState ack_result) { | 587 InputEventAckState ack_result) { |
584 if (ack_result == INPUT_EVENT_ACK_STATE_NOT_CONSUMED || | 588 if (ack_result == INPUT_EVENT_ACK_STATE_NOT_CONSUMED || |
585 ack_result == INPUT_EVENT_ACK_STATE_NO_CONSUMER_EXISTS) { | 589 ack_result == INPUT_EVENT_ACK_STATE_NO_CONSUMER_EXISTS) { |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
690 gesture_event.data.scrollUpdate.inertialPhase == | 694 gesture_event.data.scrollUpdate.inertialPhase == |
691 blink::WebGestureEvent::MomentumPhase) { | 695 blink::WebGestureEvent::MomentumPhase) { |
692 return; | 696 return; |
693 } | 697 } |
694 host_->ForwardGestureEvent(gesture_event); | 698 host_->ForwardGestureEvent(gesture_event); |
695 return; | 699 return; |
696 } | 700 } |
697 } | 701 } |
698 | 702 |
699 } // namespace content | 703 } // namespace content |
OLD | NEW |