]> khamidou — GitHub mirrors - electron.git/commitdiff
track html api triggered fullscreen separaely
authordeepak1556 <hop2deep@gmail.com>
Sat, 16 May 2015 20:07:46 +0000 (01:37 +0530)
committerdeepak1556 <hop2deep@gmail.com>
Thu, 21 May 2015 04:46:11 +0000 (10:16 +0530)
atom/browser/api/atom_api_web_contents.cc
atom/browser/native_window.cc
atom/browser/native_window.h

index 02aa76fe6a040bbfa3172a8b70ca250fe616a304..b0a6217988bcba75004de759e23fde9bd53a2a69 100644 (file)
@@ -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;
 }
index 8bc2c4616fe8aee296203070fa178538c35b38e2..6ba941ff7dde2f8da17dca6ee9b99a45d5f43ce0 100644 (file)
@@ -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();
 
index 39c58625ad2dd87f618bb5436edbd0d677ba7bec..ae53fba76f1ef2b6622003f64ad7d9db35a6a55c 100644 (file)
@@ -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_;