track html api triggered fullscreen separaely
This commit is contained in:
parent
4fe294ed04
commit
ddda8e4197
3 changed files with 20 additions and 6 deletions
|
@ -219,7 +219,7 @@ void WebContents::EnterFullscreenModeForTab(content::WebContents* source,
|
|||
const GURL& origin) {
|
||||
auto window = GetWindowFromGuest(source);
|
||||
if (window) {
|
||||
window->SetFullScreen(true);
|
||||
window->SetHtmlApiFullscreen(true);
|
||||
source->GetRenderViewHost()->WasResized();
|
||||
}
|
||||
}
|
||||
|
@ -227,7 +227,7 @@ void WebContents::EnterFullscreenModeForTab(content::WebContents* source,
|
|||
void WebContents::ExitFullscreenModeForTab(content::WebContents* source) {
|
||||
auto window = GetWindowFromGuest(source);
|
||||
if (window) {
|
||||
window->SetFullScreen(false);
|
||||
window->SetHtmlApiFullscreen(false);
|
||||
source->GetRenderViewHost()->WasResized();
|
||||
}
|
||||
}
|
||||
|
@ -236,7 +236,7 @@ bool WebContents::IsFullscreenForTabOrPending(
|
|||
const content::WebContents* source) const {
|
||||
auto window = GetWindowFromGuest(source);
|
||||
if (window)
|
||||
return window->IsFullscreen();
|
||||
return window->IsHtmlApiFullscreen();
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -99,6 +99,7 @@ NativeWindow::NativeWindow(content::WebContents* web_contents,
|
|||
is_closed_(false),
|
||||
node_integration_(true),
|
||||
has_dialog_attached_(false),
|
||||
fullscreen_(false),
|
||||
zoom_factor_(1.0),
|
||||
weak_factory_(this),
|
||||
inspectable_web_contents_(
|
||||
|
@ -698,16 +699,16 @@ void NativeWindow::RendererResponsive(content::WebContents* source) {
|
|||
|
||||
void NativeWindow::EnterFullscreenModeForTab(content::WebContents* source,
|
||||
const GURL& origin) {
|
||||
SetFullScreen(true);
|
||||
SetHtmlApiFullscreen(true);
|
||||
}
|
||||
|
||||
void NativeWindow::ExitFullscreenModeForTab(content::WebContents* source) {
|
||||
SetFullScreen(false);
|
||||
SetHtmlApiFullscreen(false);
|
||||
}
|
||||
|
||||
bool NativeWindow::IsFullscreenForTabOrPending(
|
||||
const content::WebContents* source) const {
|
||||
return IsFullscreen();
|
||||
return IsHtmlApiFullscreen();
|
||||
}
|
||||
|
||||
void NativeWindow::BeforeUnloadFired(const base::TimeTicks& proceed_time) {
|
||||
|
@ -800,6 +801,11 @@ void NativeWindow::ScheduleUnresponsiveEvent(int ms) {
|
|||
base::TimeDelta::FromMilliseconds(ms));
|
||||
}
|
||||
|
||||
void NativeWindow::SetHtmlApiFullscreen(bool enter_fullscreen) {
|
||||
SetFullScreen(enter_fullscreen);
|
||||
fullscreen_ = enter_fullscreen;
|
||||
}
|
||||
|
||||
void NativeWindow::NotifyWindowUnresponsive() {
|
||||
window_unresposive_closure_.Cancel();
|
||||
|
||||
|
|
|
@ -195,6 +195,9 @@ class NativeWindow : public brightray::DefaultWebContentsDelegate,
|
|||
int child_process_id);
|
||||
void OverrideWebkitPrefs(content::WebPreferences* prefs);
|
||||
|
||||
// Set fullscreen mode triggered by html api.
|
||||
void SetHtmlApiFullscreen(bool enter_fullscreen);
|
||||
|
||||
// Public API used by platform-dependent delegates and observers to send UI
|
||||
// related notifications.
|
||||
void NotifyWindowClosed();
|
||||
|
@ -217,6 +220,8 @@ class NativeWindow : public brightray::DefaultWebContentsDelegate,
|
|||
|
||||
bool has_frame() const { return has_frame_; }
|
||||
|
||||
bool IsHtmlApiFullscreen() const { return fullscreen_; }
|
||||
|
||||
void set_has_dialog_attached(bool has_dialog_attached) {
|
||||
has_dialog_attached_ = has_dialog_attached;
|
||||
}
|
||||
|
@ -343,6 +348,9 @@ class NativeWindow : public brightray::DefaultWebContentsDelegate,
|
|||
// There is a dialog that has been attached to window.
|
||||
bool has_dialog_attached_;
|
||||
|
||||
// Whether window is fullscreened by HTML5 api.
|
||||
bool fullscreen_;
|
||||
|
||||
// Closure that would be called when window is unresponsive when closing,
|
||||
// it should be cancelled when we can prove that the window is responsive.
|
||||
base::CancelableClosure window_unresposive_closure_;
|
||||
|
|
Loading…
Reference in a new issue