]> khamidou — GitHub mirrors - electron.git/commitdiff
window: supports HTML5 fullscreen api
authordeepak1556 <hop2deep@gmail.com>
Tue, 21 Apr 2015 13:35:36 +0000 (19:05 +0530)
committerdeepak1556 <hop2deep@gmail.com>
Thu, 23 Apr 2015 06:44:29 +0000 (12:14 +0530)
atom/browser/native_window.cc
atom/browser/native_window.h
atom/browser/native_window_mac.h
atom/browser/native_window_mac.mm
atom/browser/native_window_views.cc
atom/browser/native_window_views.h

index 0576fec057616a7d5d5a4edc5fca1ae3d64854d8..c2ed3b0fe79eedbb6385c15094b186f194acb11b 100644 (file)
@@ -685,6 +685,20 @@ void NativeWindow::RendererResponsive(content::WebContents* source) {
   FOR_EACH_OBSERVER(NativeWindowObserver, observers_, OnRendererResponsive());
 }
 
+void NativeWindow::EnterFullscreenModeForTab(content::WebContents* source,
+                                             const GURL& origin) {
+  SetFullScreen(true);
+}
+
+void NativeWindow::ExitFullscreenModeForTab(content::WebContents* source) {
+  SetFullScreen(false);
+}
+
+bool NativeWindow::IsFullscreenForTabOrPending(
+    const content::WebContents* source) const {
+  return IsFullscreen();
+}
+
 void NativeWindow::BeforeUnloadFired(const base::TimeTicks& proceed_time) {
   // Do nothing, we override this method just to avoid compilation error since
   // there are two virtual functions named BeforeUnloadFired.
index b300fce3d7b3595ddaea5e460003d202a9c7431f..b1f1a384b8bb731a32d86bc5be702dbd6310d5bd 100644 (file)
@@ -112,7 +112,7 @@ class NativeWindow : public brightray::DefaultWebContentsDelegate,
   virtual void Restore() = 0;
   virtual bool IsMinimized() = 0;
   virtual void SetFullScreen(bool fullscreen) = 0;
-  virtual bool IsFullscreen() = 0;
+  virtual bool IsFullscreen() const = 0;
   virtual void SetSize(const gfx::Size& size) = 0;
   virtual gfx::Size GetSize() = 0;
   virtual void SetContentSize(const gfx::Size& size) = 0;
@@ -273,6 +273,11 @@ class NativeWindow : public brightray::DefaultWebContentsDelegate,
       const content::WebContents* source) const override;
   void RendererUnresponsive(content::WebContents* source) override;
   void RendererResponsive(content::WebContents* source) override;
+  void EnterFullscreenModeForTab(content::WebContents* source,
+                                 const GURL& origin) override;
+  void ExitFullscreenModeForTab(content::WebContents* source) override;
+  bool IsFullscreenForTabOrPending(
+      const content::WebContents* source) const override;
 
   // Implementations of content::WebContentsObserver.
   void RenderViewCreated(content::RenderViewHost* render_view_host) override;
index d21b207841e2184536b9ecb4a02bec559adb2d7f..822594038a5ae5bc047ad1bcdc758b63e1a78716 100644 (file)
@@ -44,7 +44,7 @@ class NativeWindowMac : public NativeWindow {
   void Restore() override;
   bool IsMinimized() override;
   void SetFullScreen(bool fullscreen) override;
-  bool IsFullscreen() override;
+  bool IsFullscreen() const override;
   void SetSize(const gfx::Size& size) override;
   gfx::Size GetSize() override;
   void SetContentSize(const gfx::Size& size) override;
index 668826624b4b5f36bd2510f32f995e840d142989..ce4bc8775f4fcf51fbe3a7269e51d2205d36df9f 100644 (file)
@@ -476,7 +476,7 @@ void NativeWindowMac::SetFullScreen(bool fullscreen) {
   [window_ toggleFullScreen:nil];
 }
 
-bool NativeWindowMac::IsFullscreen() {
+bool NativeWindowMac::IsFullscreen() const {
   return [window_ styleMask] & NSFullScreenWindowMask;
 }
 
index 9dc0709946de289f0155da07f25ac709d07ea7ff..1ef0a63680c9780da8ef1179de581c5d10e6a3fc 100644 (file)
@@ -369,7 +369,7 @@ void NativeWindowViews::SetFullScreen(bool fullscreen) {
 #endif
 }
 
-bool NativeWindowViews::IsFullscreen() {
+bool NativeWindowViews::IsFullscreen() const {
   return window_->IsFullscreen();
 }
 
index 56d77afa2680bb0e29ef323cbfb3fb8818e7ee64..6ec3f2aef438f1aed888ea81cb9e03470aa8ba6c 100644 (file)
@@ -49,7 +49,7 @@ class NativeWindowViews : public NativeWindow,
   void Restore() override;
   bool IsMinimized() override;
   void SetFullScreen(bool fullscreen) override;
-  bool IsFullscreen() override;
+  bool IsFullscreen() const override;
   void SetSize(const gfx::Size& size) override;
   gfx::Size GetSize() override;
   void SetContentSize(const gfx::Size& size) override;