webview: add permission-request event

This commit is contained in:
Robo 2016-01-23 18:59:47 +05:30
parent 30b35644f6
commit 85e13333c3
12 changed files with 260 additions and 3 deletions

View file

@ -167,6 +167,14 @@ A list of strings which specifies the blink features to be enabled separated by
The full list of supported feature strings can be found in the
[setFeatureEnabledFromString][blink-feature-string] function.
### `disablewebnotification`
```html
<webview src="https://www.github.com/" disablewebnotification></webview>
```
If "on", the guest page will have web notifications disabled.
## Methods
The `webview` tag has the following methods:
@ -736,4 +744,22 @@ Emitted when DevTools is closed.
Emitted when DevTools is focused / opened.
### Event: 'permission-request'
Returns:
* `permission` String - The type of permission being requested. Enum of 'media', 'webNotification'.
* `allow` Function - Allows the permission.
* `deny` Function - Deny the permission. This is the default behaviour if `allow` is not called.
Emitted when guest page requires special permission.
```javascript
// This will deny guest page access to the webkitGetUserMedia API.
webview.addEventListener('permission-request', function(e) {
if (e.permission === 'media')
e.deny();
});
```
[blink-feature-string]: https://code.google.com/p/chromium/codesearch#chromium/src/out/Debug/gen/blink/platform/RuntimeEnabledFeatures.cpp&sq=package:chromium&type=cs&l=527