| 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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 #include "content/browser/media/android/media_web_contents_observer_android.h" | 50 #include "content/browser/media/android/media_web_contents_observer_android.h" |
| 51 #include "content/browser/renderer_host/compositor_impl_android.h" | 51 #include "content/browser/renderer_host/compositor_impl_android.h" |
| 52 #include "content/browser/renderer_host/dip_util.h" | 52 #include "content/browser/renderer_host/dip_util.h" |
| 53 #include "content/browser/renderer_host/frame_metadata_util.h" | 53 #include "content/browser/renderer_host/frame_metadata_util.h" |
| 54 #include "content/browser/renderer_host/input/synthetic_gesture_target_android.h
" | 54 #include "content/browser/renderer_host/input/synthetic_gesture_target_android.h
" |
| 55 #include "content/browser/renderer_host/input/web_input_event_builders_android.h
" | 55 #include "content/browser/renderer_host/input/web_input_event_builders_android.h
" |
| 56 #include "content/browser/renderer_host/input/web_input_event_util.h" | 56 #include "content/browser/renderer_host/input/web_input_event_util.h" |
| 57 #include "content/browser/renderer_host/render_process_host_impl.h" | 57 #include "content/browser/renderer_host/render_process_host_impl.h" |
| 58 #include "content/browser/renderer_host/render_view_host_impl.h" | 58 #include "content/browser/renderer_host/render_view_host_impl.h" |
| 59 #include "content/browser/renderer_host/render_widget_host_impl.h" | 59 #include "content/browser/renderer_host/render_widget_host_impl.h" |
| 60 #include "content/browser/renderer_host/select_action_mode.h" |
| 60 #include "content/common/gpu_host_messages.h" | 61 #include "content/common/gpu_host_messages.h" |
| 61 #include "content/common/gpu_process_launch_causes.h" | 62 #include "content/common/gpu_process_launch_causes.h" |
| 62 #include "content/common/input/did_overscroll_params.h" | 63 #include "content/common/input/did_overscroll_params.h" |
| 63 #include "content/common/input_messages.h" | 64 #include "content/common/input_messages.h" |
| 64 #include "content/common/view_messages.h" | 65 #include "content/common/view_messages.h" |
| 65 #include "content/public/browser/android/compositor.h" | 66 #include "content/public/browser/android/compositor.h" |
| 66 #include "content/public/browser/browser_thread.h" | 67 #include "content/public/browser/browser_thread.h" |
| 67 #include "content/public/browser/devtools_agent_host.h" | 68 #include "content/public/browser/devtools_agent_host.h" |
| 68 #include "content/public/browser/render_view_host.h" | 69 #include "content/public/browser/render_view_host.h" |
| 69 #include "content/public/browser/render_widget_host_iterator.h" | 70 #include "content/public/browser/render_widget_host_iterator.h" |
| 70 #include "content/public/common/content_switches.h" | 71 #include "content/public/common/content_switches.h" |
| 72 #include "content/public/common/context_menu_params.h" |
| 71 #include "gpu/command_buffer/client/gles2_implementation.h" | 73 #include "gpu/command_buffer/client/gles2_implementation.h" |
| 72 #include "gpu/command_buffer/client/gles2_interface.h" | 74 #include "gpu/command_buffer/client/gles2_interface.h" |
| 73 #include "gpu/config/gpu_driver_bug_workaround_type.h" | 75 #include "gpu/config/gpu_driver_bug_workaround_type.h" |
| 74 #include "ipc/ipc_message_macros.h" | 76 #include "ipc/ipc_message_macros.h" |
| 75 #include "ipc/ipc_message_start.h" | 77 #include "ipc/ipc_message_start.h" |
| 76 #include "skia/ext/image_operations.h" | 78 #include "skia/ext/image_operations.h" |
| 77 #include "third_party/khronos/GLES2/gl2.h" | 79 #include "third_party/khronos/GLES2/gl2.h" |
| 78 #include "third_party/khronos/GLES2/gl2ext.h" | 80 #include "third_party/khronos/GLES2/gl2ext.h" |
| 79 #include "third_party/skia/include/core/SkCanvas.h" | 81 #include "third_party/skia/include/core/SkCanvas.h" |
| 80 #include "ui/android/window_android.h" | 82 #include "ui/android/window_android.h" |
| (...skipping 1123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1204 ui::SelectionEventType event) { | 1206 ui::SelectionEventType event) { |
| 1205 DCHECK(content_view_core_); | 1207 DCHECK(content_view_core_); |
| 1206 DCHECK(selection_controller_); | 1208 DCHECK(selection_controller_); |
| 1207 // If a selection drag has started, it has taken over the active touch | 1209 // If a selection drag has started, it has taken over the active touch |
| 1208 // sequence. Immediately cancel gesture detection and any downstream touch | 1210 // sequence. Immediately cancel gesture detection and any downstream touch |
| 1209 // listeners (e.g., web content) to communicate this transfer. | 1211 // listeners (e.g., web content) to communicate this transfer. |
| 1210 if (event == ui::SELECTION_HANDLES_SHOWN && | 1212 if (event == ui::SELECTION_HANDLES_SHOWN && |
| 1211 gesture_provider_.GetCurrentDownEvent()) { | 1213 gesture_provider_.GetCurrentDownEvent()) { |
| 1212 ResetGestureDetection(); | 1214 ResetGestureDetection(); |
| 1213 } | 1215 } |
| 1216 |
| 1217 switch(event) { |
| 1218 case ui::SelectionEventType::SELECTION_HANDLES_SHOWN: |
| 1219 if (select_action_mode_) |
| 1220 select_action_mode_->show(); |
| 1221 break; |
| 1222 |
| 1223 case ui::SelectionEventType::SELECTION_HANDLES_MOVED: |
| 1224 case ui::SelectionEventType::INSERTION_HANDLE_MOVED: |
| 1225 if (select_action_mode_) |
| 1226 select_action_mode_->move( |
| 1227 GetSelectionRect(*selection_controller_)); |
| 1228 break; |
| 1229 |
| 1230 case ui::SelectionEventType::SELECTION_HANDLES_CLEARED: |
| 1231 case ui::SelectionEventType::INSERTION_HANDLE_CLEARED: |
| 1232 if (select_action_mode_) |
| 1233 select_action_mode_.reset(); |
| 1234 break; |
| 1235 |
| 1236 case ui::SelectionEventType::SELECTION_HANDLE_DRAG_STARTED: |
| 1237 case ui::SelectionEventType::INSERTION_HANDLE_DRAG_STARTED: |
| 1238 if (select_action_mode_) |
| 1239 select_action_mode_->hide(); |
| 1240 break; |
| 1241 |
| 1242 case ui::SelectionEventType::SELECTION_HANDLE_DRAG_STOPPED: |
| 1243 case ui::SelectionEventType::INSERTION_HANDLE_DRAG_STOPPED: |
| 1244 if (select_action_mode_) |
| 1245 select_action_mode_->show(); |
| 1246 break; |
| 1247 |
| 1248 case ui::SelectionEventType::INSERTION_HANDLE_TAPPED: |
| 1249 // TODO |
| 1250 break; |
| 1251 |
| 1252 case ui::SelectionEventType::INSERTION_HANDLE_SHOWN: |
| 1253 case ui::SelectionEventType::SELECTION_ESTABLISHED: |
| 1254 case ui::SelectionEventType::SELECTION_DISSOLVED: |
| 1255 break; |
| 1256 |
| 1257 default: |
| 1258 NOTREACHED(); |
| 1259 break; |
| 1260 } |
| 1261 |
| 1214 content_view_core_->OnSelectionEvent( | 1262 content_view_core_->OnSelectionEvent( |
| 1215 event, selection_controller_->GetStartPosition(), | 1263 event, selection_controller_->GetStartPosition()); |
| 1216 GetSelectionRect(*selection_controller_)); | |
| 1217 } | 1264 } |
| 1218 | 1265 |
| 1219 std::unique_ptr<ui::TouchHandleDrawable> | 1266 std::unique_ptr<ui::TouchHandleDrawable> |
| 1220 RenderWidgetHostViewAndroid::CreateDrawable() { | 1267 RenderWidgetHostViewAndroid::CreateDrawable() { |
| 1221 DCHECK(content_view_core_); | 1268 DCHECK(content_view_core_); |
| 1222 if (!using_browser_compositor_) | 1269 if (!using_browser_compositor_) |
| 1223 return PopupTouchHandleDrawable::Create(content_view_core_); | 1270 return PopupTouchHandleDrawable::Create(content_view_core_); |
| 1224 | 1271 |
| 1225 return std::unique_ptr< | 1272 return std::unique_ptr< |
| 1226 ui::TouchHandleDrawable>(new CompositedTouchHandleDrawable( | 1273 ui::TouchHandleDrawable>(new CompositedTouchHandleDrawable( |
| (...skipping 807 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2034 return; | 2081 return; |
| 2035 case ui::MotionEvent::ACTION_UP: | 2082 case ui::MotionEvent::ACTION_UP: |
| 2036 case ui::MotionEvent::ACTION_POINTER_UP: | 2083 case ui::MotionEvent::ACTION_POINTER_UP: |
| 2037 UMA_HISTOGRAM_CUSTOM_COUNTS("Event.Latency.OS.TOUCH_RELEASED", | 2084 UMA_HISTOGRAM_CUSTOM_COUNTS("Event.Latency.OS.TOUCH_RELEASED", |
| 2038 delta.InMicroseconds(), 1, 1000000, 50); | 2085 delta.InMicroseconds(), 1, 1000000, 50); |
| 2039 default: | 2086 default: |
| 2040 return; | 2087 return; |
| 2041 } | 2088 } |
| 2042 } | 2089 } |
| 2043 | 2090 |
| 2091 void RenderWidgetHostViewAndroid::CreateSelectActionMode( |
| 2092 const content::ContextMenuParams& params) { |
| 2093 select_action_mode_.reset(new SelectActionMode(params)); |
| 2094 } |
| 2044 } // namespace content | 2095 } // namespace content |
| OLD | NEW |