OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/renderer_host/render_widget_host_view_android.h" | 5 #include "content/browser/renderer_host/render_widget_host_view_android.h" |
6 | 6 |
7 #include <android/bitmap.h> | 7 #include <android/bitmap.h> |
8 | 8 |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 #include "skia/ext/image_operations.h" | 75 #include "skia/ext/image_operations.h" |
76 #include "third_party/khronos/GLES2/gl2.h" | 76 #include "third_party/khronos/GLES2/gl2.h" |
77 #include "third_party/khronos/GLES2/gl2ext.h" | 77 #include "third_party/khronos/GLES2/gl2ext.h" |
78 #include "third_party/skia/include/core/SkCanvas.h" | 78 #include "third_party/skia/include/core/SkCanvas.h" |
79 #include "ui/android/delegated_frame_host_android.h" | 79 #include "ui/android/delegated_frame_host_android.h" |
80 #include "ui/android/window_android.h" | 80 #include "ui/android/window_android.h" |
81 #include "ui/android/window_android_compositor.h" | 81 #include "ui/android/window_android_compositor.h" |
82 #include "ui/base/layout.h" | 82 #include "ui/base/layout.h" |
83 #include "ui/display/display.h" | 83 #include "ui/display/display.h" |
84 #include "ui/display/screen.h" | 84 #include "ui/display/screen.h" |
| 85 #include "ui/events/base_event_utils.h" |
85 #include "ui/events/blink/blink_event_util.h" | 86 #include "ui/events/blink/blink_event_util.h" |
86 #include "ui/events/blink/did_overscroll_params.h" | 87 #include "ui/events/blink/did_overscroll_params.h" |
87 #include "ui/events/blink/web_input_event_traits.h" | 88 #include "ui/events/blink/web_input_event_traits.h" |
88 #include "ui/events/gesture_detection/gesture_provider_config_helper.h" | 89 #include "ui/events/gesture_detection/gesture_provider_config_helper.h" |
89 #include "ui/events/gesture_detection/motion_event.h" | 90 #include "ui/events/gesture_detection/motion_event.h" |
90 #include "ui/gfx/android/device_display_info.h" | 91 #include "ui/gfx/android/device_display_info.h" |
91 #include "ui/gfx/android/java_bitmap.h" | 92 #include "ui/gfx/android/java_bitmap.h" |
92 #include "ui/gfx/android/view_configuration.h" | 93 #include "ui/gfx/android/view_configuration.h" |
93 #include "ui/gfx/geometry/dip_util.h" | 94 #include "ui/gfx/geometry/dip_util.h" |
94 #include "ui/gfx/geometry/size_conversions.h" | 95 #include "ui/gfx/geometry/size_conversions.h" |
(...skipping 1555 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1650 // out-of-process iframes), pick the one that should process this event. | 1651 // out-of-process iframes), pick the one that should process this event. |
1651 if (host_->delegate()) | 1652 if (host_->delegate()) |
1652 target_host = host_->delegate()->GetFocusedRenderWidgetHost(host_); | 1653 target_host = host_->delegate()->GetFocusedRenderWidgetHost(host_); |
1653 if (!target_host) | 1654 if (!target_host) |
1654 return; | 1655 return; |
1655 | 1656 |
1656 target_host->ForwardKeyboardEvent(event); | 1657 target_host->ForwardKeyboardEvent(event); |
1657 } | 1658 } |
1658 | 1659 |
1659 void RenderWidgetHostViewAndroid::SendMouseEvent( | 1660 void RenderWidgetHostViewAndroid::SendMouseEvent( |
1660 const blink::WebMouseEvent& event) { | 1661 const ui::MotionEventAndroid& motion_event, |
| 1662 int changed_button) { |
| 1663 blink::WebInputEvent::Type webMouseEventType = |
| 1664 ui::ToWebMouseEventType(motion_event.GetAction()); |
| 1665 |
| 1666 blink::WebMouseEvent mouse_event = WebMouseEventBuilder::Build( |
| 1667 webMouseEventType, |
| 1668 ui::EventTimeStampToSeconds(motion_event.GetEventTime()), |
| 1669 motion_event.GetX(0), |
| 1670 motion_event.GetY(0), |
| 1671 motion_event.GetFlags(), |
| 1672 motion_event.GetButtonState() ? 1 : 0 /* click count */, |
| 1673 motion_event.GetPointerId(0), |
| 1674 motion_event.GetPressure(0), |
| 1675 motion_event.GetOrientation(0), |
| 1676 motion_event.GetTilt(0), |
| 1677 changed_button, |
| 1678 motion_event.GetToolType(0)); |
| 1679 |
1661 if (host_) | 1680 if (host_) |
1662 host_->ForwardMouseEvent(event); | 1681 host_->ForwardMouseEvent(mouse_event); |
1663 } | 1682 } |
1664 | 1683 |
1665 void RenderWidgetHostViewAndroid::SendMouseWheelEvent( | 1684 void RenderWidgetHostViewAndroid::SendMouseWheelEvent( |
1666 const blink::WebMouseWheelEvent& event) { | 1685 const blink::WebMouseWheelEvent& event) { |
1667 if (host_) { | 1686 if (host_) { |
1668 ui::LatencyInfo latency_info(ui::SourceEventType::WHEEL); | 1687 ui::LatencyInfo latency_info(ui::SourceEventType::WHEEL); |
1669 latency_info.AddLatencyNumber(ui::INPUT_EVENT_LATENCY_UI_COMPONENT, 0, 0); | 1688 latency_info.AddLatencyNumber(ui::INPUT_EVENT_LATENCY_UI_COMPONENT, 0, 0); |
1670 host_->ForwardWheelEventWithLatencyInfo(event, latency_info); | 1689 host_->ForwardWheelEventWithLatencyInfo(event, latency_info); |
1671 } | 1690 } |
1672 } | 1691 } |
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1966 case ui::MotionEvent::ACTION_UP: | 1985 case ui::MotionEvent::ACTION_UP: |
1967 case ui::MotionEvent::ACTION_POINTER_UP: | 1986 case ui::MotionEvent::ACTION_POINTER_UP: |
1968 UMA_HISTOGRAM_CUSTOM_COUNTS("Event.Latency.OS.TOUCH_RELEASED", | 1987 UMA_HISTOGRAM_CUSTOM_COUNTS("Event.Latency.OS.TOUCH_RELEASED", |
1969 delta.InMicroseconds(), 1, 1000000, 50); | 1988 delta.InMicroseconds(), 1, 1000000, 50); |
1970 default: | 1989 default: |
1971 return; | 1990 return; |
1972 } | 1991 } |
1973 } | 1992 } |
1974 | 1993 |
1975 } // namespace content | 1994 } // namespace content |
OLD | NEW |