feat: add support for HIDDevice.forget() (#34210)

* feat: add support for HIDDevice.forget()

* chore: remove whitespace

* chore: use `SetGetter` to serialize the render_frame_host

Co-authored-by: Samuel Maddock <samuel.maddock@gmail.com>

* fixup chore: use `SetGetter` to serialize the render_frame_host

* fixup after rebase

* fixup for crash on navigator.serial.getPorts()

* fixup for lint

Co-authored-by: Samuel Maddock <samuel.maddock@gmail.com>
This commit is contained in:
John Kleinschmidt 2022-05-23 15:13:18 -04:00 committed by GitHub
parent df9383cb3c
commit ba573f5583
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
15 changed files with 359 additions and 114 deletions

View file

@ -443,13 +443,20 @@ class WebContents : public ExclusiveAccessContext,
blink::PermissionType permissionType,
content::RenderFrameHost* render_frame_host);
// Revokes |origin| access to |device|.
// To be used in place of ObjectPermissionContextBase::RevokeObjectPermission.
void RevokeDevicePermission(const url::Origin& origin,
const base::Value* device,
blink::PermissionType permission_type,
content::RenderFrameHost* render_frame_host);
// Returns the list of devices that |origin| has been granted permission to
// access. To be used in place of
// ObjectPermissionContextBase::GetGrantedObjects.
std::vector<base::Value> GetGrantedDevices(
const url::Origin& origin,
blink::PermissionType permissionType,
content::RenderFrameHost* render_frame_host);
bool CheckDevicePermission(const url::Origin& origin,
const base::Value* device,
blink::PermissionType permissionType,
content::RenderFrameHost* render_frame_host);
// disable copy
WebContents(const WebContents&) = delete;
@ -746,6 +753,10 @@ class WebContents : public ExclusiveAccessContext,
// Update the html fullscreen flag in both browser and renderer.
void UpdateHtmlApiFullscreen(bool fullscreen);
bool DoesDeviceMatch(const base::Value* device,
const base::Value* device_to_compare,
blink::PermissionType permission_type);
v8::Global<v8::Value> session_;
v8::Global<v8::Value> devtools_web_contents_;
v8::Global<v8::Value> debugger_;