extensions/browser/guest_view/web_view/README.md
This directory contains key classes that are part of the WebView feature implementation, integrating //components/guest_view with the //extensions system.
The current Webview permission request API supports a small set of WebView permissions. Some of these permissions overlap with Web Permissions (e.g. media, geolocation, HID, pointer lock). Some of these are WebView-specific permissions (new window, javascript dialog, etc). In the browser process when a RenderFrameHost (RFH) is created, the RFH is configured to support WebView's handling for particular permission events (for plugins).
When a WebView is created by the embedder, as part of WebView initialization in the browser process the WebView system will create a handler for permission events:
The WebView embedder adds an event handler for permissionrequest events:
When the WebView embedded content requests a permission:
At this point, some additional handling will occur that's permission-specific. We'll skip over some of those steps but for one case -- geolocation -- we'll provide some of that detail:
For geolocation, the last DecidePermission() call is where the WebView code intercepts the permission request. Stepping back to look at all of the permission types, the browser relays the permission into permission-specific code for each of those types similar to this. Here's a list of those intercepts, including geolocation:
permissionrequest event.
request.allow() is called, the embedder indicates that the permission
should be granted. But the grant is still subject to the embedder being trusted
to grant the permission (see below).
All other PermissionTypes, except for geolocation, audio and video, are explicitly rejected as "not requestable" in WebView.