webview: add permission-request event
This commit is contained in:
parent
30b35644f6
commit
85e13333c3
12 changed files with 260 additions and 3 deletions
|
@ -34,7 +34,8 @@ var WEB_VIEW_EVENTS = {
|
|||
'page-favicon-updated': ['favicons'],
|
||||
'enter-html-full-screen': [],
|
||||
'leave-html-full-screen': [],
|
||||
'found-in-page': ['result']
|
||||
'found-in-page': ['result'],
|
||||
'permission-request': ['permission', 'allow', 'deny']
|
||||
};
|
||||
|
||||
var DEPRECATED_EVENTS = {
|
||||
|
@ -64,6 +65,15 @@ module.exports = {
|
|||
ipcRenderer.on("ATOM_SHELL_GUEST_VIEW_INTERNAL_DISPATCH_EVENT-" + viewInstanceId, function() {
|
||||
var eventName = arguments[1];
|
||||
var args = 3 <= arguments.length ? slice.call(arguments, 2) : [];
|
||||
if (eventName === 'permission-request') {
|
||||
var allow = function allow() {
|
||||
ipcRenderer.send("ATOM_SHELL_GUEST_VIEW_MANAGER_SET_PERMISSION_RESPONSE", viewInstanceId, args[0], true);
|
||||
};
|
||||
var deny = function deny() {
|
||||
ipcRenderer.send("ATOM_SHELL_GUEST_VIEW_MANAGER_SET_PERMISSION_RESPONSE", viewInstanceId, args[0], false);
|
||||
};
|
||||
args = args.concat([allow, deny]);
|
||||
}
|
||||
return dispatchEvent.apply(null, [webView, eventName, eventName].concat(slice.call(args)));
|
||||
});
|
||||
ipcRenderer.on("ATOM_SHELL_GUEST_VIEW_INTERNAL_IPC_MESSAGE-" + viewInstanceId, function() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue