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 "base/android/build_info.h" | 9 #include "base/android/build_info.h" |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 #include "content/public/common/content_switches.h" | 70 #include "content/public/common/content_switches.h" |
71 #include "gpu/command_buffer/client/gles2_implementation.h" | 71 #include "gpu/command_buffer/client/gles2_implementation.h" |
72 #include "gpu/command_buffer/client/gles2_interface.h" | 72 #include "gpu/command_buffer/client/gles2_interface.h" |
73 #include "gpu/config/gpu_driver_bug_workaround_type.h" | 73 #include "gpu/config/gpu_driver_bug_workaround_type.h" |
74 #include "skia/ext/image_operations.h" | 74 #include "skia/ext/image_operations.h" |
75 #include "third_party/khronos/GLES2/gl2.h" | 75 #include "third_party/khronos/GLES2/gl2.h" |
76 #include "third_party/khronos/GLES2/gl2ext.h" | 76 #include "third_party/khronos/GLES2/gl2ext.h" |
77 #include "third_party/skia/include/core/SkCanvas.h" | 77 #include "third_party/skia/include/core/SkCanvas.h" |
78 #include "ui/android/window_android.h" | 78 #include "ui/android/window_android.h" |
79 #include "ui/android/window_android_compositor.h" | 79 #include "ui/android/window_android_compositor.h" |
| 80 #include "ui/events/blink/blink_event_util.h" |
80 #include "ui/events/gesture_detection/gesture_provider_config_helper.h" | 81 #include "ui/events/gesture_detection/gesture_provider_config_helper.h" |
81 #include "ui/events/gesture_detection/motion_event.h" | 82 #include "ui/events/gesture_detection/motion_event.h" |
82 #include "ui/gfx/android/device_display_info.h" | 83 #include "ui/gfx/android/device_display_info.h" |
83 #include "ui/gfx/android/java_bitmap.h" | 84 #include "ui/gfx/android/java_bitmap.h" |
84 #include "ui/gfx/android/view_configuration.h" | 85 #include "ui/gfx/android/view_configuration.h" |
85 #include "ui/gfx/display.h" | 86 #include "ui/gfx/display.h" |
86 #include "ui/gfx/geometry/dip_util.h" | 87 #include "ui/gfx/geometry/dip_util.h" |
87 #include "ui/gfx/geometry/size_conversions.h" | 88 #include "ui/gfx/geometry/size_conversions.h" |
88 #include "ui/gfx/screen.h" | 89 #include "ui/gfx/screen.h" |
89 #include "ui/touch_selection/touch_selection_controller.h" | 90 #include "ui/touch_selection/touch_selection_controller.h" |
(...skipping 754 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
844 | 845 |
845 if (stylus_text_selector_.OnTouchEvent(event)) | 846 if (stylus_text_selector_.OnTouchEvent(event)) |
846 return true; | 847 return true; |
847 | 848 |
848 ui::FilteredGestureProvider::TouchHandlingResult result = | 849 ui::FilteredGestureProvider::TouchHandlingResult result = |
849 gesture_provider_.OnTouchEvent(event); | 850 gesture_provider_.OnTouchEvent(event); |
850 if (!result.succeeded) | 851 if (!result.succeeded) |
851 return false; | 852 return false; |
852 | 853 |
853 blink::WebTouchEvent web_event = | 854 blink::WebTouchEvent web_event = |
854 CreateWebTouchEventFromMotionEvent(event, result.did_generate_scroll); | 855 ui::CreateWebTouchEventFromMotionEvent(event, result.did_generate_scroll); |
855 host_->ForwardTouchEventWithLatencyInfo(web_event, | 856 host_->ForwardTouchEventWithLatencyInfo(web_event, |
856 CreateLatencyInfo(web_event)); | 857 CreateLatencyInfo(web_event)); |
857 | 858 |
858 // Send a proactive BeginFrame on the next vsync to reduce latency. | 859 // Send a proactive BeginFrame on the next vsync to reduce latency. |
859 // This is good enough as long as the first touch event has Begin semantics | 860 // This is good enough as long as the first touch event has Begin semantics |
860 // and the actual scroll happens on the next vsync. | 861 // and the actual scroll happens on the next vsync. |
861 if (observing_root_window_) | 862 if (observing_root_window_) |
862 RequestVSyncUpdate(BEGIN_FRAME); | 863 RequestVSyncUpdate(BEGIN_FRAME); |
863 | 864 |
864 return true; | 865 return true; |
(...skipping 980 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1845 cc::SurfaceDrawStatus status) { | 1846 cc::SurfaceDrawStatus status) { |
1846 while (!ack_callbacks_.empty()) { | 1847 while (!ack_callbacks_.empty()) { |
1847 ack_callbacks_.front().Run(); | 1848 ack_callbacks_.front().Run(); |
1848 ack_callbacks_.pop(); | 1849 ack_callbacks_.pop(); |
1849 } | 1850 } |
1850 } | 1851 } |
1851 | 1852 |
1852 void RenderWidgetHostViewAndroid::OnGestureEvent( | 1853 void RenderWidgetHostViewAndroid::OnGestureEvent( |
1853 const ui::GestureEventData& gesture) { | 1854 const ui::GestureEventData& gesture) { |
1854 blink::WebGestureEvent web_gesture = | 1855 blink::WebGestureEvent web_gesture = |
1855 CreateWebGestureEventFromGestureEventData(gesture); | 1856 ui::CreateWebGestureEventFromGestureEventData(gesture); |
1856 // TODO(jdduke): Remove this workaround after Android fixes UiAutomator to | 1857 // TODO(jdduke): Remove this workaround after Android fixes UiAutomator to |
1857 // stop providing shift meta values to synthetic MotionEvents. This prevents | 1858 // stop providing shift meta values to synthetic MotionEvents. This prevents |
1858 // unintended shift+click interpretation of all accessibility clicks. | 1859 // unintended shift+click interpretation of all accessibility clicks. |
1859 // See crbug.com/443247. | 1860 // See crbug.com/443247. |
1860 if (web_gesture.type == blink::WebInputEvent::GestureTap && | 1861 if (web_gesture.type == blink::WebInputEvent::GestureTap && |
1861 web_gesture.modifiers == blink::WebInputEvent::ShiftKey) { | 1862 web_gesture.modifiers == blink::WebInputEvent::ShiftKey) { |
1862 web_gesture.modifiers = 0; | 1863 web_gesture.modifiers = 0; |
1863 } | 1864 } |
1864 SendGestureEvent(web_gesture); | 1865 SendGestureEvent(web_gesture); |
1865 } | 1866 } |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2047 results->orientationAngle = display.RotationAsDegree(); | 2048 results->orientationAngle = display.RotationAsDegree(); |
2048 results->orientationType = | 2049 results->orientationType = |
2049 RenderWidgetHostViewBase::GetOrientationTypeForMobile(display); | 2050 RenderWidgetHostViewBase::GetOrientationTypeForMobile(display); |
2050 gfx::DeviceDisplayInfo info; | 2051 gfx::DeviceDisplayInfo info; |
2051 results->depth = info.GetBitsPerPixel(); | 2052 results->depth = info.GetBitsPerPixel(); |
2052 results->depthPerComponent = info.GetBitsPerComponent(); | 2053 results->depthPerComponent = info.GetBitsPerComponent(); |
2053 results->isMonochrome = (results->depthPerComponent == 0); | 2054 results->isMonochrome = (results->depthPerComponent == 0); |
2054 } | 2055 } |
2055 | 2056 |
2056 } // namespace content | 2057 } // namespace content |
OLD | NEW |