Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(197)

Side by Side Diff: content/browser/renderer_host/render_widget_host_view_android.cc

Issue 2089933002: Context Menu Refactor (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: removed unnecessary code Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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_->close();
no sievers 2016/06/23 23:16:41 why does this need a call to close() first while b
amaralp 2016/06/24 00:45:49 Good point. I previously had this implemented in J
1234 select_action_mode_.reset();
1235 }
1236 break;
1237
1238 case ui::SelectionEventType::SELECTION_HANDLE_DRAG_STARTED:
1239 case ui::SelectionEventType::INSERTION_HANDLE_DRAG_STARTED:
1240 if (select_action_mode_)
1241 select_action_mode_->hide();
1242 break;
1243
1244 case ui::SelectionEventType::SELECTION_HANDLE_DRAG_STOPPED:
1245 case ui::SelectionEventType::INSERTION_HANDLE_DRAG_STOPPED:
1246 if (select_action_mode_)
1247 select_action_mode_->show();
1248 break;
1249
1250 case ui::SelectionEventType::INSERTION_HANDLE_TAPPED:
1251 // TODO
no sievers 2016/06/23 23:16:41 can you put a bug number that also explains what's
amaralp 2016/06/24 00:45:49 This is just something for myself so that I don't
1252 break;
1253
1254 case ui::SelectionEventType::INSERTION_HANDLE_SHOWN:
1255 case ui::SelectionEventType::SELECTION_ESTABLISHED:
1256 case ui::SelectionEventType::SELECTION_DISSOLVED:
1257 break;
1258
1259 default:
1260 NOTREACHED();
1261 break;
1262 }
no sievers 2016/06/23 23:16:41 What about other events we listened to in ContentV
amaralp 2016/06/24 00:45:49 You are right. I'll have to take a look at those m
no sievers 2016/06/24 22:17:25 Note that we know about visibility (host_->is_hidd
1263
1214 content_view_core_->OnSelectionEvent( 1264 content_view_core_->OnSelectionEvent(
1215 event, selection_controller_->GetStartPosition(), 1265 event, selection_controller_->GetStartPosition());
1216 GetSelectionRect(*selection_controller_));
1217 } 1266 }
1218 1267
1219 std::unique_ptr<ui::TouchHandleDrawable> 1268 std::unique_ptr<ui::TouchHandleDrawable>
1220 RenderWidgetHostViewAndroid::CreateDrawable() { 1269 RenderWidgetHostViewAndroid::CreateDrawable() {
1221 DCHECK(content_view_core_); 1270 DCHECK(content_view_core_);
1222 if (!using_browser_compositor_) 1271 if (!using_browser_compositor_)
1223 return PopupTouchHandleDrawable::Create(content_view_core_); 1272 return PopupTouchHandleDrawable::Create(content_view_core_);
1224 1273
1225 return std::unique_ptr< 1274 return std::unique_ptr<
1226 ui::TouchHandleDrawable>(new CompositedTouchHandleDrawable( 1275 ui::TouchHandleDrawable>(new CompositedTouchHandleDrawable(
(...skipping 807 matching lines...) Expand 10 before | Expand all | Expand 10 after
2034 return; 2083 return;
2035 case ui::MotionEvent::ACTION_UP: 2084 case ui::MotionEvent::ACTION_UP:
2036 case ui::MotionEvent::ACTION_POINTER_UP: 2085 case ui::MotionEvent::ACTION_POINTER_UP:
2037 UMA_HISTOGRAM_CUSTOM_COUNTS("Event.Latency.OS.TOUCH_RELEASED", 2086 UMA_HISTOGRAM_CUSTOM_COUNTS("Event.Latency.OS.TOUCH_RELEASED",
2038 delta.InMicroseconds(), 1, 1000000, 50); 2087 delta.InMicroseconds(), 1, 1000000, 50);
2039 default: 2088 default:
2040 return; 2089 return;
2041 } 2090 }
2042 } 2091 }
2043 2092
2093 void RenderWidgetHostViewAndroid::CreateSelectActionMode(
2094 const content::ContextMenuParams& params) {
2095 select_action_mode_.reset(new SelectActionMode(params));
2096 }
2044 } // namespace content 2097 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698