feat: add session.setPermissionCheckHandler (#13925)
* feat: add session.setPermissionCheckHandler to handle syncornous permission checks vs requests * spec: add tests for session.setPermissionCheckHandler * docs: add docs for session.setPermissionCheckHandler * feat: add mediaType to media permission checks * chore: cleanup check impl
This commit is contained in:
parent
afdb6c5f90
commit
68da311ed1
10 changed files with 142 additions and 1 deletions
|
@ -100,6 +100,11 @@ void AtomPermissionManager::SetPermissionRequestHandler(
|
|||
request_handler_ = handler;
|
||||
}
|
||||
|
||||
void AtomPermissionManager::SetPermissionCheckHandler(
|
||||
const CheckHandler& handler) {
|
||||
check_handler_ = handler;
|
||||
}
|
||||
|
||||
int AtomPermissionManager::RequestPermission(
|
||||
content::PermissionType permission,
|
||||
content::RenderFrameHost* render_frame_host,
|
||||
|
@ -223,4 +228,18 @@ int AtomPermissionManager::SubscribePermissionStatusChange(
|
|||
void AtomPermissionManager::UnsubscribePermissionStatusChange(
|
||||
int subscription_id) {}
|
||||
|
||||
bool AtomPermissionManager::CheckPermissionWithDetails(
|
||||
content::PermissionType permission,
|
||||
content::RenderFrameHost* render_frame_host,
|
||||
const GURL& requesting_origin,
|
||||
const base::DictionaryValue* details) const {
|
||||
if (check_handler_.is_null()) {
|
||||
return true;
|
||||
}
|
||||
auto* web_contents =
|
||||
content::WebContents::FromRenderFrameHost(render_frame_host);
|
||||
return check_handler_.Run(web_contents, permission, requesting_origin,
|
||||
*details);
|
||||
}
|
||||
|
||||
} // namespace atom
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue