| 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 511 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 555 const blink::WebFloatPoint& screenPosition) const { | 556 const blink::WebFloatPoint& screenPosition) const { |
| 556 if (!HasFocus()) { | 557 if (!HasFocus()) { |
| 557 // We need to a account for the position of the guest view within the | 558 // We need to a account for the position of the guest view within the |
| 558 // embedder, as well as the fact that the embedder's host will add its | 559 // embedder, as well as the fact that the embedder's host will add its |
| 559 // offset in screen coordinates before sending the event (with the latter | 560 // offset in screen coordinates before sending the event (with the latter |
| 560 // component just serving to confuse the renderer, hence why it should be | 561 // component just serving to confuse the renderer, hence why it should be |
| 561 // removed). | 562 // removed). |
| 562 gfx::Vector2d offset = | 563 gfx::Vector2d offset = |
| 563 GetViewBounds().origin() - | 564 GetViewBounds().origin() - |
| 564 GetOwnerRenderWidgetHostView()->GetBoundsInRootWindow().origin(); | 565 GetOwnerRenderWidgetHostView()->GetBoundsInRootWindow().origin(); |
| 565 blink::WebGestureEvent gesture_tap_event; | 566 blink::WebGestureEvent gesture_tap_event( |
| 567 blink::WebGestureEvent::GestureTapDown, |
| 568 blink::WebInputEvent::NoModifiers, |
| 569 ui::EventTimeStampToSeconds(ui::EventTimeForNow())); |
| 566 gesture_tap_event.sourceDevice = blink::WebGestureDeviceTouchscreen; | 570 gesture_tap_event.sourceDevice = blink::WebGestureDeviceTouchscreen; |
| 567 gesture_tap_event.type = blink::WebGestureEvent::GestureTapDown; | |
| 568 gesture_tap_event.x = position.x + offset.x(); | 571 gesture_tap_event.x = position.x + offset.x(); |
| 569 gesture_tap_event.y = position.y + offset.y(); | 572 gesture_tap_event.y = position.y + offset.y(); |
| 570 gesture_tap_event.globalX = screenPosition.x; | 573 gesture_tap_event.globalX = screenPosition.x; |
| 571 gesture_tap_event.globalY = screenPosition.y; | 574 gesture_tap_event.globalY = screenPosition.y; |
| 572 GetOwnerRenderWidgetHostView()->ProcessGestureEvent( | 575 GetOwnerRenderWidgetHostView()->ProcessGestureEvent( |
| 573 gesture_tap_event, ui::LatencyInfo(ui::SourceEventType::TOUCH)); | 576 gesture_tap_event, ui::LatencyInfo(ui::SourceEventType::TOUCH)); |
| 574 gesture_tap_event.type = blink::WebGestureEvent::GestureTapCancel; | 577 |
| 578 gesture_tap_event.setType(blink::WebGestureEvent::GestureTapCancel); |
| 575 GetOwnerRenderWidgetHostView()->ProcessGestureEvent( | 579 GetOwnerRenderWidgetHostView()->ProcessGestureEvent( |
| 576 gesture_tap_event, ui::LatencyInfo(ui::SourceEventType::TOUCH)); | 580 gesture_tap_event, ui::LatencyInfo(ui::SourceEventType::TOUCH)); |
| 577 } | 581 } |
| 578 } | 582 } |
| 579 | 583 |
| 580 void RenderWidgetHostViewGuest::WheelEventAck( | 584 void RenderWidgetHostViewGuest::WheelEventAck( |
| 581 const blink::WebMouseWheelEvent& event, | 585 const blink::WebMouseWheelEvent& event, |
| 582 InputEventAckState ack_result) { | 586 InputEventAckState ack_result) { |
| 583 if (ack_result == INPUT_EVENT_ACK_STATE_NOT_CONSUMED || | 587 if (ack_result == INPUT_EVENT_ACK_STATE_NOT_CONSUMED || |
| 584 ack_result == INPUT_EVENT_ACK_STATE_NO_CONSUMER_EXISTS) { | 588 ack_result == INPUT_EVENT_ACK_STATE_NO_CONSUMER_EXISTS) { |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 689 gesture_event.data.scrollUpdate.inertialPhase == | 693 gesture_event.data.scrollUpdate.inertialPhase == |
| 690 blink::WebGestureEvent::MomentumPhase) { | 694 blink::WebGestureEvent::MomentumPhase) { |
| 691 return; | 695 return; |
| 692 } | 696 } |
| 693 host_->ForwardGestureEvent(gesture_event); | 697 host_->ForwardGestureEvent(gesture_event); |
| 694 return; | 698 return; |
| 695 } | 699 } |
| 696 } | 700 } |
| 697 | 701 |
| 698 } // namespace content | 702 } // namespace content |
| OLD | NEW |