add fullscreen permission type
This commit is contained in:
parent
45eada306f
commit
b575cd0ef9
6 changed files with 30 additions and 5 deletions
|
@ -390,6 +390,18 @@ void WebContents::HandleKeyboardEvent(
|
|||
|
||||
void WebContents::EnterFullscreenModeForTab(content::WebContents* source,
|
||||
const GURL& origin) {
|
||||
auto permission_helper =
|
||||
WebContentsPermissionHelper::FromWebContents(source);
|
||||
auto callback = base::Bind(&WebContents::OnEnterFullscreenModeForTab,
|
||||
base::Unretained(this), source, origin);
|
||||
permission_helper->RequestFullscreenPermission(callback);
|
||||
}
|
||||
|
||||
void WebContents::OnEnterFullscreenModeForTab(content::WebContents* source,
|
||||
const GURL& origin,
|
||||
bool allowed) {
|
||||
if (!allowed)
|
||||
return;
|
||||
CommonWebContentsDelegate::EnterFullscreenModeForTab(source, origin);
|
||||
Emit("enter-html-full-screen");
|
||||
}
|
||||
|
|
|
@ -133,6 +133,11 @@ class WebContents : public mate::TrackableObject<WebContents>,
|
|||
void SetAllowTransparency(bool allow);
|
||||
bool IsGuest() const;
|
||||
|
||||
// Callback triggered on permission response.
|
||||
void OnEnterFullscreenModeForTab(content::WebContents* source,
|
||||
const GURL& origin,
|
||||
bool allowed);
|
||||
|
||||
// Returns the web preferences of current WebContents.
|
||||
v8::Local<v8::Value> GetWebPreferences(v8::Isolate* isolate);
|
||||
|
||||
|
|
|
@ -102,6 +102,12 @@ void WebContentsPermissionHelper::RequestPermission(
|
|||
base::Bind(&OnPermissionResponse, callback));
|
||||
}
|
||||
|
||||
void WebContentsPermissionHelper::RequestFullscreenPermission(
|
||||
const base::Callback<void(bool)>& callback) {
|
||||
RequestPermission((content::PermissionType)(PermissionType::FULLSCREEN),
|
||||
callback);
|
||||
}
|
||||
|
||||
void WebContentsPermissionHelper::RequestMediaAccessPermission(
|
||||
const content::MediaStreamRequest& request,
|
||||
const content::MediaResponseCallback& response_callback) {
|
||||
|
|
|
@ -22,6 +22,8 @@ class WebContentsPermissionHelper
|
|||
FULLSCREEN
|
||||
};
|
||||
|
||||
void RequestFullscreenPermission(
|
||||
const base::Callback<void(bool)>& callback);
|
||||
void RequestMediaAccessPermission(
|
||||
const content::MediaStreamRequest& request,
|
||||
const content::MediaResponseCallback& callback);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue