]> khamidou — GitHub mirrors - electron.git/commitdiff
webContents: override fullscreen notification apis for webview
authordeepak1556 <hop2deep@gmail.com>
Fri, 8 May 2015 06:18:15 +0000 (11:48 +0530)
committerdeepak1556 <hop2deep@gmail.com>
Thu, 21 May 2015 04:46:10 +0000 (10:16 +0530)
atom/browser/api/atom_api_web_contents.cc
atom/browser/api/atom_api_web_contents.h

index b0f0a95ed2fdb65482387553bc32d6a0ae2e762c..2bd496ffce7492909fb1ae1050f8f6320af31109 100644 (file)
@@ -215,6 +215,26 @@ void WebContents::HandleKeyboardEvent(
       web_contents(), event);
 }
 
+void WebContents::EnterFullscreenModeForTab(content::WebContents* web_contents,
+                                            const GURL& origin) {
+  GetWindowFromGuest(web_contents)->SetFullScreen(true);
+  web_contents->GetRenderViewHost()->WasResized();
+}
+
+void WebContents::ExitFullscreenModeForTab(content::WebContents* web_contents) {
+  GetWindowFromGuest(web_contents)->SetFullScreen(false);
+  web_contents->GetRenderViewHost()->WasResized();
+}
+
+bool WebContents::IsFullscreenForTabOrPending(
+    const content::WebContents* web_contents) const {
+  auto window = GetWindowFromGuest(web_contents);
+  if (window)
+    return window->IsFullscreen();
+  else
+    return false;
+}
+
 void WebContents::RenderViewDeleted(content::RenderViewHost* render_view_host) {
   Emit("render-view-deleted",
        render_view_host->GetProcess()->GetID(),
index eb69d65bf9aa54a5a08d6b8276d40067a2990825..5e9a93e3b5c2a16f14e44abaf5e3efc550d64ab1 100644 (file)
@@ -151,6 +151,11 @@ class WebContents : public mate::EventEmitter,
   void HandleKeyboardEvent(
       content::WebContents* source,
       const content::NativeWebKeyboardEvent& event) override;
+  void EnterFullscreenModeForTab(content::WebContents* web_contents,
+                                 const GURL& origin) override;
+  void ExitFullscreenModeForTab(content::WebContents* web_contents) override;
+  bool IsFullscreenForTabOrPending(
+      const content::WebContents* web_contents) const override;
 
   // content::WebContentsObserver:
   void RenderViewDeleted(content::RenderViewHost*) override;