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

Issue 186213003: <webview>: Context menu API implementation CL. (Closed)

Created:
6 years, 9 months ago by lazyboy
Modified:
6 years, 9 months ago
CC:
chromium-reviews, chromium-apps-reviews_chromium.org, extensions-reviews_chromium.org
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Visibility:
Public.

Description

<webview>: Context menu API implementation CL. Very Similar to chrome.contextMenus API, only applies to the <webview> that it is called upon. var w = document.querySelector('webview'); w.contextMenus.OnClicked.addListener(function() { .. }); w.contextMenus.create({id: '1', title: 'one'}); w.contextMenus.update({id: '2', title: 'new', onclick: ...}); w.contextMenus.remove('1'); w.contextMenus.removeAll('1'); This CL adds the actual implementation to the previously exposed skeleton API. Docs/snippets here: https://docs.google.com/a/chromium.org/document/d/1AoMD6kF8ui1dikzTrwK-weVHegSqQaLV2zx4xJSh_fQ/edit TBR=stevenjb@chromium.org BUG=140315 Test=Can be tested inside a chrome apps <webview>. <webview>.contextMenus.create(...) to create custom context menu items. The API is similar to chrome.contextMenus API. Similarly .update, .remove, .removeAll is also supported. Click event handler can be specified as <webview>.contextMenus.onClick.addListener(...). Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=255917

Patch Set 1 #

Total comments: 11

Patch Set 2 : Sync and address comments. #

Total comments: 4

Patch Set 3 : Make {extension_id,webview_instance_id} key for MenuManager items. #

Total comments: 10

Patch Set 4 : fix WriteToStorage, AddChildItem #

Patch Set 5 : remove exposing webviewInstanceId #

Patch Set 6 : Put ExtensionKey into MenuItem::Id. #

Total comments: 22

Patch Set 7 : Address comment from fady. #

Patch Set 8 : Address comments from fady. #

Patch Set 9 : . #

Patch Set 10 : . #

Patch Set 11 : sync @tott. #

Patch Set 12 : remove someunwanted changes. #

Patch Set 13 : Added test + fixed MenuManager::ExtensionIds(). #

Total comments: 19

Patch Set 14 : Address comments. #

Patch Set 15 : Fix typo #

Patch Set 16 : sync @tott. #

Total comments: 2

Patch Set 17 : Address comments. #

Patch Set 18 : Fix mac compile. #

Patch Set 19 : include #

Patch Set 20 : actually fix this time. #

Patch Set 21 : Fix unit_tests #

Patch Set 22 : fix ui/ash/launcher_context_menu #

Patch Set 23 : copy extension_key instead of ref in MenuManager::RemoveContextMenuItem() #

Patch Set 24 : sync @tott #

Unified diffs Side-by-side diffs Delta from patch set Stats (+780 lines, -272 lines) Patch
M chrome/browser/apps/web_view_browsertest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 5 chunks +87 lines, -0 lines 0 comments Download
M chrome/browser/extensions/api/context_menus/context_menus_api.cc View 1 2 3 4 5 6 4 chunks +10 lines, -6 lines 0 comments Download
M chrome/browser/extensions/api/context_menus/context_menus_api_helpers.h View 1 2 3 4 5 6 7 8 9 10 11 11 chunks +25 lines, -19 lines 0 comments Download
M chrome/browser/extensions/api/webview/webview_api.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 7 chunks +55 lines, -14 lines 0 comments Download
M chrome/browser/extensions/context_menu_matcher.h View 1 2 3 chunks +3 lines, -3 lines 0 comments Download
M chrome/browser/extensions/context_menu_matcher.cc View 1 2 5 chunks +10 lines, -10 lines 0 comments Download
M chrome/browser/extensions/event_names.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 1 chunk +1 line, -0 lines 0 comments Download
M chrome/browser/extensions/event_names.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 1 chunk +1 line, -0 lines 0 comments Download
M chrome/browser/extensions/extension_context_menu_browsertest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 13 chunks +28 lines, -87 lines 0 comments Download
M chrome/browser/extensions/menu_manager.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 7 chunks +37 lines, -15 lines 0 comments Download
M chrome/browser/extensions/menu_manager.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 21 chunks +103 lines, -50 lines 0 comments Download
M chrome/browser/extensions/menu_manager_unittest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 19 chunks +47 lines, -37 lines 0 comments Download
M chrome/browser/guestview/webview/context_menu_content_type_webview.cc View 1 chunk +3 lines, -1 line 0 comments Download
M chrome/browser/guestview/webview/webview_guest.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 1 chunk +3 lines, -0 lines 0 comments Download
M chrome/browser/guestview/webview/webview_guest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 3 chunks +16 lines, -0 lines 0 comments Download
M chrome/browser/renderer_context_menu/render_view_context_menu.h View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +2 lines, -3 lines 0 comments Download
M chrome/browser/renderer_context_menu/render_view_context_menu.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 5 chunks +19 lines, -10 lines 0 comments Download
M chrome/browser/renderer_context_menu/render_view_context_menu_test_util.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 3 chunks +27 lines, -0 lines 0 comments Download
M chrome/browser/renderer_context_menu/render_view_context_menu_test_util.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 3 chunks +45 lines, -0 lines 0 comments Download
M chrome/browser/ui/app_list/app_context_menu.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 2 chunks +3 lines, -2 lines 0 comments Download
M chrome/browser/ui/ash/launcher/launcher_context_menu.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 chunk +4 lines, -3 lines 0 comments Download
M chrome/renderer/resources/extensions/webview_custom_bindings.js View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 1 chunk +1 line, -0 lines 0 comments Download
A + chrome/test/data/extensions/platform_apps/web_view/context_menus/basic/embedder.html View 1 2 3 4 5 6 7 8 9 10 11 12 0 chunks +-1 lines, --1 lines 0 comments Download
A chrome/test/data/extensions/platform_apps/web_view/context_menus/basic/embedder.js View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +232 lines, -0 lines 0 comments Download
A + chrome/test/data/extensions/platform_apps/web_view/context_menus/basic/guest.js View 1 2 3 4 5 6 7 8 9 10 11 12 2 chunks +5 lines, -14 lines 0 comments Download
A chrome/test/data/extensions/platform_apps/web_view/context_menus/basic/manifest.json View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +15 lines, -0 lines 0 comments Download
A + chrome/test/data/extensions/platform_apps/web_view/context_menus/basic/test.js View 1 2 3 4 5 6 7 8 9 10 11 12 0 chunks +-1 lines, --1 lines 0 comments Download

Messages

Total messages: 40 (0 generated)
lazyboy
Please take a look before I forward it to Yoyo.
6 years, 9 months ago (2014-03-04 01:13:16 UTC) #1
Fady Samuel
https://codereview.chromium.org/186213003/diff/1/chrome/browser/extensions/menu_manager.cc File chrome/browser/extensions/menu_manager.cc (right): https://codereview.chromium.org/186213003/diff/1/chrome/browser/extensions/menu_manager.cc#newcode516 chrome/browser/extensions/menu_manager.cc:516: for (i = context_items_[extension_id].begin(); I think it would be ...
6 years, 9 months ago (2014-03-04 01:56:46 UTC) #2
lazyboy
https://chromiumcodereview.appspot.com/186213003/diff/1/chrome/browser/extensions/menu_manager.cc File chrome/browser/extensions/menu_manager.cc (right): https://chromiumcodereview.appspot.com/186213003/diff/1/chrome/browser/extensions/menu_manager.cc#newcode516 chrome/browser/extensions/menu_manager.cc:516: for (i = context_items_[extension_id].begin(); On 2014/03/04 01:56:46, Fady Samuel ...
6 years, 9 months ago (2014-03-04 16:11:31 UTC) #3
Fady Samuel
https://chromiumcodereview.appspot.com/186213003/diff/1/chrome/browser/extensions/menu_manager.cc File chrome/browser/extensions/menu_manager.cc (right): https://chromiumcodereview.appspot.com/186213003/diff/1/chrome/browser/extensions/menu_manager.cc#newcode516 chrome/browser/extensions/menu_manager.cc:516: for (i = context_items_[extension_id].begin(); On 2014/03/04 16:11:31, lazyboy wrote: ...
6 years, 9 months ago (2014-03-04 16:36:00 UTC) #4
lazyboy
https://chromiumcodereview.appspot.com/186213003/diff/1/chrome/browser/extensions/menu_manager.cc File chrome/browser/extensions/menu_manager.cc (right): https://chromiumcodereview.appspot.com/186213003/diff/1/chrome/browser/extensions/menu_manager.cc#newcode516 chrome/browser/extensions/menu_manager.cc:516: for (i = context_items_[extension_id].begin(); On 2014/03/04 16:36:00, Fady Samuel ...
6 years, 9 months ago (2014-03-04 20:50:24 UTC) #5
lazyboy
https://chromiumcodereview.appspot.com/186213003/diff/1/chrome/browser/extensions/menu_manager.cc File chrome/browser/extensions/menu_manager.cc (right): https://chromiumcodereview.appspot.com/186213003/diff/1/chrome/browser/extensions/menu_manager.cc#newcode695 chrome/browser/extensions/menu_manager.cc:695: properties->SetInteger("webviewInstanceId", guest_view->view_instance_id()); On 2014/03/04 20:50:24, lazyboy wrote: > On ...
6 years, 9 months ago (2014-03-04 21:13:49 UTC) #6
Fady Samuel
https://chromiumcodereview.appspot.com/186213003/diff/30001/chrome/browser/extensions/menu_manager.cc File chrome/browser/extensions/menu_manager.cc (right): https://chromiumcodereview.appspot.com/186213003/diff/30001/chrome/browser/extensions/menu_manager.cc#newcode657 chrome/browser/extensions/menu_manager.cc:657: GuestView* guest_view = GuestView::FromWebContents(web_contents); Can we make this WebViewGuest::FromWebContents ...
6 years, 9 months ago (2014-03-04 21:14:58 UTC) #7
lazyboy
https://chromiumcodereview.appspot.com/186213003/diff/30001/chrome/browser/extensions/menu_manager.cc File chrome/browser/extensions/menu_manager.cc (right): https://chromiumcodereview.appspot.com/186213003/diff/30001/chrome/browser/extensions/menu_manager.cc#newcode657 chrome/browser/extensions/menu_manager.cc:657: GuestView* guest_view = GuestView::FromWebContents(web_contents); On 2014/03/04 21:14:59, Fady Samuel ...
6 years, 9 months ago (2014-03-04 23:07:01 UTC) #8
Fady Samuel
Bunch of comments as I read through the code that all more or less center ...
6 years, 9 months ago (2014-03-05 17:54:09 UTC) #9
lazyboy
Bunch of comments as I read through the code that all more or less center ...
6 years, 9 months ago (2014-03-05 18:27:58 UTC) #10
Fady Samuel
lgtm
6 years, 9 months ago (2014-03-05 18:51:37 UTC) #11
lazyboy
+yoz@ for review. I've added browsertests. Yoyo, can you take a look? This is the ...
6 years, 9 months ago (2014-03-06 05:29:16 UTC) #12
lazyboy
https://chromiumcodereview.appspot.com/186213003/diff/220001/chrome/test/data/extensions/platform_apps/web_view/context_menus/basic/manifest.json File chrome/test/data/extensions/platform_apps/web_view/context_menus/basic/manifest.json (right): https://chromiumcodereview.appspot.com/186213003/diff/220001/chrome/test/data/extensions/platform_apps/web_view/context_menus/basic/manifest.json#newcode8 chrome/test/data/extensions/platform_apps/web_view/context_menus/basic/manifest.json:8: "contextMenus" FYI, this is something I still need to ...
6 years, 9 months ago (2014-03-06 17:21:14 UTC) #13
Yoyo Zhou
https://chromiumcodereview.appspot.com/186213003/diff/220001/chrome/browser/apps/web_view_browsertest.cc File chrome/browser/apps/web_view_browsertest.cc (right): https://chromiumcodereview.appspot.com/186213003/diff/220001/chrome/browser/apps/web_view_browsertest.cc#newcode142 chrome/browser/apps/web_view_browsertest.cc:142: class TestRenderViewContextMenu : public RenderViewContextMenu { This looks duplicated ...
6 years, 9 months ago (2014-03-07 02:40:30 UTC) #14
lazyboy
https://chromiumcodereview.appspot.com/186213003/diff/220001/chrome/browser/apps/web_view_browsertest.cc File chrome/browser/apps/web_view_browsertest.cc (right): https://chromiumcodereview.appspot.com/186213003/diff/220001/chrome/browser/apps/web_view_browsertest.cc#newcode142 chrome/browser/apps/web_view_browsertest.cc:142: class TestRenderViewContextMenu : public RenderViewContextMenu { On 2014/03/07 02:40:30, ...
6 years, 9 months ago (2014-03-07 06:38:02 UTC) #15
Yoyo Zhou
LGTM, looks much better. Thanks for cleaning up the test menu code. https://chromiumcodereview.appspot.com/186213003/diff/270001/chrome/browser/renderer_context_menu/render_view_context_menu_test_util.cc File chrome/browser/renderer_context_menu/render_view_context_menu_test_util.cc ...
6 years, 9 months ago (2014-03-07 23:03:21 UTC) #16
lazyboy
https://chromiumcodereview.appspot.com/186213003/diff/270001/chrome/browser/renderer_context_menu/render_view_context_menu_test_util.cc File chrome/browser/renderer_context_menu/render_view_context_menu_test_util.cc (right): https://chromiumcodereview.appspot.com/186213003/diff/270001/chrome/browser/renderer_context_menu/render_view_context_menu_test_util.cc#newcode18 chrome/browser/renderer_context_menu/render_view_context_menu_test_util.cc:18: // static. On 2014/03/07 23:03:21, Yoyo Zhou wrote: > ...
6 years, 9 months ago (2014-03-08 00:16:45 UTC) #17
lazyboy
The CQ bit was checked by lazyboy@chromium.org
6 years, 9 months ago (2014-03-08 02:02:59 UTC) #18
lazyboy
The CQ bit was unchecked by lazyboy@chromium.org
6 years, 9 months ago (2014-03-08 06:48:53 UTC) #19
lazyboy
The CQ bit was checked by lazyboy@chromium.org
6 years, 9 months ago (2014-03-08 06:49:05 UTC) #20
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/lazyboy@chromium.org/186213003/280001
6 years, 9 months ago (2014-03-08 11:16:03 UTC) #21
commit-bot: I haz the power
The CQ bit was unchecked by commit-bot@chromium.org
6 years, 9 months ago (2014-03-08 11:49:00 UTC) #22
commit-bot: I haz the power
Try jobs failed on following builders: linux_chromium_rel
6 years, 9 months ago (2014-03-08 11:49:01 UTC) #23
lazyboy
The CQ bit was checked by lazyboy@chromium.org
6 years, 9 months ago (2014-03-08 13:49:58 UTC) #24
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/lazyboy@chromium.org/186213003/280001
6 years, 9 months ago (2014-03-08 13:50:45 UTC) #25
commit-bot: I haz the power
The CQ bit was unchecked by commit-bot@chromium.org
6 years, 9 months ago (2014-03-08 14:18:53 UTC) #26
commit-bot: I haz the power
Try jobs failed on following builders: mac_chromium_compile_dbg
6 years, 9 months ago (2014-03-08 14:18:53 UTC) #27
lazyboy
xiyuan@chromium.org: Please review changes in chrome/browser/ui/app_list/app_context_menu.cc
6 years, 9 months ago (2014-03-08 20:24:41 UTC) #28
lazyboy
The CQ bit was checked by lazyboy@chromium.org
6 years, 9 months ago (2014-03-08 23:49:51 UTC) #29
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/lazyboy@chromium.org/186213003/340001
6 years, 9 months ago (2014-03-08 23:49:57 UTC) #30
lazyboy
The CQ bit was unchecked by lazyboy@chromium.org
6 years, 9 months ago (2014-03-08 23:49:57 UTC) #31
lazyboy
The CQ bit was unchecked by lazyboy@chromium.org
6 years, 9 months ago (2014-03-08 23:50:35 UTC) #32
xiyuan
app_list lgtm
6 years, 9 months ago (2014-03-09 01:09:39 UTC) #33
lazyboy
The CQ bit was checked by lazyboy@chromium.org
6 years, 9 months ago (2014-03-09 06:39:15 UTC) #34
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/lazyboy@chromium.org/186213003/360001
6 years, 9 months ago (2014-03-09 06:39:27 UTC) #35
commit-bot: I haz the power
The CQ bit was unchecked by commit-bot@chromium.org
6 years, 9 months ago (2014-03-09 07:12:25 UTC) #36
commit-bot: I haz the power
Try jobs failed on following builders: linux_chromium_chromeos_clang_dbg
6 years, 9 months ago (2014-03-09 07:12:26 UTC) #37
lazyboy
The CQ bit was checked by lazyboy@chromium.org
6 years, 9 months ago (2014-03-10 10:10:12 UTC) #38
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/lazyboy@chromium.org/186213003/420001
6 years, 9 months ago (2014-03-10 10:10:22 UTC) #39
commit-bot: I haz the power
6 years, 9 months ago (2014-03-10 12:12:34 UTC) #40
Message was sent while issue was closed.
Change committed as 255917

Powered by Google App Engine
This is Rietveld 408576698