|
|
Context Menu Refactor
Currently there are 3 different ways a context menu is generated:
1) The "Copy, Cut, Paste, ..." context menu is triggered by selection handles being shown in ContentViewCore.java. This context menu is then populated according to ContentViewCore's current state of the text (i.e. don't show "Copy" or "Cut" options if text is a password). I believe this state is mostly kept up to date through the ContentViewCore's updateImeAdapter method.
2) The "Paste" menu is triggered on long press. The long press event is converted to a right click event which triggers blink to show a context menu. Eventually this gets delegated to either "AwWebContentsViewDelegate" or "ChromeWebContentsViewDelegateAndroid." I believe this is done because WebView doesn't support Modal context menus (discussed in #3), but it is also duplicates code.
3) The Modal context menu has the same path as the Paste menu (#2) up until ChromeWebContentsViewDelegateAndroid. There ShowContextMenu checks the ContextMenuParams to see if a Modal or Paste Menu is appropriate.
The goal of the CL is to make the first type of context menu be triggered in blink as a context menu. This would make it so a ContextMenuParams argument is passed during the creation meaning that creating the menu wouldn’t have to rely on state from updateImeAdapter. This also has the benefit that it unifies the first and second context menu types.
My plan to accomplish this is to have long pressing or double tapping text not only select the text but also send a right click event. Then to avoid WebView and Chrome code duplication I handle the context menu in WebContentsDelegateAndroid::HandleContextMenu (to get this to work I had to add an extra parameter to this method and hence change many files). WebContentsDelegateAndroid then notifies RenderWidgetHostViewAndroid to show the menu. RenderWidgetHostViewAndroid creates a SelectActionMode object that communicates to its java counterpart when to show/hide/move/close the menu.
BUG= 598880, 623783
Total comments: 27
Total comments: 1
|
Unified diffs |
Side-by-side diffs |
Delta from patch set |
Stats (+322 lines, -607 lines) |
Patch |
 |
M |
android_webview/native/aw_web_contents_view_delegate.cc
|
View
|
1
|
1 chunk |
+0 lines, -14 lines |
0 comments
|
Download
|
 |
M |
chrome/android/java/src/org/chromium/chrome/browser/ChromeActivity.java
|
View
|
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
 |
M |
chrome/android/java/src/org/chromium/chrome/browser/omnibox/UrlBar.java
|
View
|
|
2 chunks |
+0 lines, -8 lines |
0 comments
|
Download
|
 |
M |
chrome/browser/chromeos/first_run/first_run_view.h
|
View
|
1
|
1 chunk |
+2 lines, -1 line |
0 comments
|
Download
|
 |
M |
chrome/browser/chromeos/first_run/first_run_view.cc
|
View
|
1
|
1 chunk |
+2 lines, -2 lines |
0 comments
|
Download
|
 |
M |
chrome/browser/chromeos/login/ui/webui_login_view.h
|
View
|
|
1 chunk |
+2 lines, -1 line |
0 comments
|
Download
|
 |
M |
chrome/browser/chromeos/login/ui/webui_login_view.cc
|
View
|
1
2
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
 |
M |
chrome/browser/extensions/api/tab_capture/offscreen_tab.h
|
View
|
|
1 chunk |
+2 lines, -1 line |
0 comments
|
Download
|
 |
M |
chrome/browser/extensions/api/tab_capture/offscreen_tab.cc
|
View
|
|
1 chunk |
+2 lines, -1 line |
0 comments
|
Download
|
 |
M |
chrome/browser/ui/android/tab_contents/chrome_web_contents_view_delegate_android.cc
|
View
|
1
|
1 chunk |
+7 lines, -16 lines |
0 comments
|
Download
|
 |
M |
chrome/browser/ui/panels/panel_extension_browsertest.cc
|
View
|
|
5 chunks |
+10 lines, -5 lines |
0 comments
|
Download
|
 |
M |
chrome/browser/ui/views/profiles/profile_chooser_view.h
|
View
|
|
1 chunk |
+2 lines, -1 line |
0 comments
|
Download
|
 |
M |
chrome/browser/ui/views/profiles/profile_chooser_view.cc
|
View
|
|
1 chunk |
+1 line, -0 lines |
0 comments
|
Download
|
 |
M |
components/web_contents_delegate_android/DEPS
|
View
|
|
1 chunk |
+1 line, -0 lines |
0 comments
|
Download
|
 |
M |
components/web_contents_delegate_android/web_contents_delegate_android.h
|
View
|
|
1 chunk |
+2 lines, -1 line |
0 comments
|
Download
|
 |
M |
components/web_contents_delegate_android/web_contents_delegate_android.cc
|
View
|
|
3 chunks |
+26 lines, -0 lines |
0 comments
|
Download
|
 |
M |
content/browser/android/browser_jni_registrar.cc
|
View
|
|
2 chunks |
+2 lines, -0 lines |
0 comments
|
Download
|
 |
M |
content/browser/android/content_view_core_impl.h
|
View
|
|
2 chunks |
+1 line, -3 lines |
0 comments
|
Download
|
 |
M |
content/browser/android/content_view_core_impl.cc
|
View
|
|
2 chunks |
+3 lines, -22 lines |
0 comments
|
Download
|
 |
M |
content/browser/renderer_host/render_widget_host_view_android.h
|
View
|
|
3 chunks |
+4 lines, -0 lines |
0 comments
|
Download
|
 |
M |
content/browser/renderer_host/render_widget_host_view_android.cc
|
View
|
1
2
|
4 chunks |
+53 lines, -2 lines |
0 comments
|
Download
|
 |
A |
content/browser/renderer_host/select_action_mode.h
|
View
|
1
2
|
1 chunk |
+38 lines, -0 lines |
0 comments
|
Download
|
 |
A |
content/browser/renderer_host/select_action_mode.cc
|
View
|
1
2
|
1 chunk |
+84 lines, -0 lines |
0 comments
|
Download
|
 |
M |
content/browser/site_per_process_browsertest.cc
|
View
|
|
1 chunk |
+2 lines, -1 line |
0 comments
|
Download
|
 |
M |
content/browser/web_contents/web_contents_impl.cc
|
View
|
|
1 chunk |
+2 lines, -1 line |
0 comments
|
Download
|
 |
M |
content/content_browser.gypi
|
View
|
|
1 chunk |
+2 lines, -0 lines |
0 comments
|
Download
|
 |
M |
content/content_jni.gypi
|
View
|
|
1 chunk |
+1 line, -0 lines |
0 comments
|
Download
|
 |
M |
content/public/android/BUILD.gn
|
View
|
|
1 chunk |
+1 line, -0 lines |
0 comments
|
Download
|
 |
M |
content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java
|
View
|
|
26 chunks |
+6 lines, -513 lines |
0 comments
|
Download
|
 |
A |
content/public/android/java/src/org/chromium/content/browser/input/SelectActionMode.java
|
View
|
1
2
|
1 chunk |
+38 lines, -0 lines |
1 comment
|
Download
|
 |
M |
content/public/browser/android/content_view_core.h
|
View
|
|
1 chunk |
+0 lines, -1 line |
0 comments
|
Download
|
 |
M |
content/public/browser/web_contents_delegate.h
|
View
|
|
1 chunk |
+2 lines, -1 line |
0 comments
|
Download
|
 |
M |
content/public/browser/web_contents_delegate.cc
|
View
|
|
1 chunk |
+1 line, -0 lines |
0 comments
|
Download
|
 |
M |
content/shell/browser/shell.h
|
View
|
|
1 chunk |
+2 lines, -1 line |
0 comments
|
Download
|
 |
M |
content/shell/browser/shell.cc
|
View
|
|
1 chunk |
+2 lines, -1 line |
0 comments
|
Download
|
 |
M |
extensions/browser/guest_view/app_view/app_view_guest.h
|
View
|
|
1 chunk |
+2 lines, -1 line |
0 comments
|
Download
|
 |
M |
extensions/browser/guest_view/app_view/app_view_guest.cc
|
View
|
|
1 chunk |
+2 lines, -1 line |
0 comments
|
Download
|
 |
M |
extensions/browser/guest_view/extension_options/extension_options_guest.h
|
View
|
|
1 chunk |
+2 lines, -1 line |
0 comments
|
Download
|
 |
M |
extensions/browser/guest_view/extension_options/extension_options_guest.cc
|
View
|
|
1 chunk |
+1 line, -0 lines |
0 comments
|
Download
|
 |
M |
extensions/browser/guest_view/mime_handler_view/mime_handler_view_guest.h
|
View
|
|
1 chunk |
+2 lines, -1 line |
0 comments
|
Download
|
 |
M |
extensions/browser/guest_view/mime_handler_view/mime_handler_view_guest.cc
|
View
|
|
1 chunk |
+1 line, -0 lines |
0 comments
|
Download
|
 |
M |
extensions/browser/guest_view/web_view/web_view_guest.h
|
View
|
|
1 chunk |
+2 lines, -1 line |
0 comments
|
Download
|
 |
M |
extensions/browser/guest_view/web_view/web_view_guest.cc
|
View
|
|
1 chunk |
+2 lines, -2 lines |
0 comments
|
Download
|
 |
M |
ui/views/controls/webview/web_dialog_view.cc
|
View
|
|
1 chunk |
+3 lines, -1 line |
0 comments
|
Download
|
Total messages: 14 (6 generated)
|