From ddda8e4197588d0c3f4d791c1f7d6263d61957db Mon Sep 17 00:00:00 2001 From: deepak1556 Date: Sun, 17 May 2015 01:37:46 +0530 Subject: [PATCH] track html api triggered fullscreen separaely --- atom/browser/api/atom_api_web_contents.cc | 6 +++--- atom/browser/native_window.cc | 12 +++++++++--- atom/browser/native_window.h | 8 ++++++++ 3 files changed, 20 insertions(+), 6 deletions(-) diff --git a/atom/browser/api/atom_api_web_contents.cc b/atom/browser/api/atom_api_web_contents.cc index 02aa76f..b0a6217 100644 --- a/atom/browser/api/atom_api_web_contents.cc +++ b/atom/browser/api/atom_api_web_contents.cc @@ -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; } diff --git a/atom/browser/native_window.cc b/atom/browser/native_window.cc index 8bc2c46..6ba941f 100644 --- a/atom/browser/native_window.cc +++ b/atom/browser/native_window.cc @@ -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(); diff --git a/atom/browser/native_window.h b/atom/browser/native_window.h index 39c5862..ae53fba 100644 --- a/atom/browser/native_window.h +++ b/atom/browser/native_window.h @@ -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_; -- 2.7.4