Description<webview>: make context menus cancellable using JS API.
Expose <webview>.contextMenus.onShow
chrome EventTarget like object so one can "addListener" that can
preventDefault() to cancel bringing up <webview> context menu.
BUG=465733
Test=Open a chrome app with <webview>. E.g.
Load a <webview> in a chrome app, e.g.
the browser sample app:
https://github.com/GoogleChrome/chrome-app-samples/tree/master/samples/webview-samples/browser
Right click on the <webview>, context menu is expected to be shown.
Now open the app's inspector: from chrome://inspect, switch to "Apps" then select to inspect "Browser sample".
Register a listener to disable context menu:
document.querySelector('webview').contextMenus.onShow.addListener(function(e) {
e.preventDefault();
});
Right click on the <webview> again, context menu should not show up.
Committed: https://crrev.com/514286582142e26e93a09f5aeefb538259ad1f41
Cr-Commit-Position: refs/heads/master@{#322477}
Patch Set 1 #Patch Set 2 : Cleaned up. #Patch Set 3 : remove unused require #
Total comments: 3
Patch Set 4 : Object -> $Object #Patch Set 5 : rename onContextMenu -> onShow, rename other internal constant values #Patch Set 6 : add todo for documentation #
Total comments: 2
Patch Set 7 : address comments from yoz@ #
Total comments: 2
Patch Set 8 : address comments from yoz@ #
Messages
Total messages: 18 (4 generated)
|