feat: add 'disableHtmlFullscreenWindowResize' option to webPreferences (#17203)

This option allows users to prevent the window from resizing when the HTML5 FullScreen API is used.
This commit is contained in:
Samuel Maddock 2019-03-07 18:29:37 -05:00 committed by Samuel Attard
parent f3fc4023cf
commit ac88b3ead5
7 changed files with 58 additions and 1 deletions

View file

@ -619,7 +619,17 @@ void CommonWebContentsDelegate::SetHtmlApiFullscreen(bool enter_fullscreen) {
return;
}
owner_window_->SetFullScreen(enter_fullscreen);
// Set fullscreen on window if allowed.
auto* web_preferences = WebContentsPreferences::From(GetWebContents());
bool html_fullscreenable =
web_preferences ? !web_preferences->IsEnabled(
options::kDisableHtmlFullscreenWindowResize)
: true;
if (html_fullscreenable) {
owner_window_->SetFullScreen(enter_fullscreen);
}
html_fullscreen_ = enter_fullscreen;
native_fullscreen_ = false;
}