From be5715103773e945f492ae905cc8f2be31376e02 Mon Sep 17 00:00:00 2001 From: deepak1556 Date: Fri, 8 May 2015 11:48:15 +0530 Subject: [PATCH] webContents: override fullscreen notification apis for webview --- atom/browser/api/atom_api_web_contents.cc | 20 ++++++++++++++++++++ atom/browser/api/atom_api_web_contents.h | 5 +++++ 2 files changed, 25 insertions(+) diff --git a/atom/browser/api/atom_api_web_contents.cc b/atom/browser/api/atom_api_web_contents.cc index b0f0a95ed2..2bd496ffce 100644 --- a/atom/browser/api/atom_api_web_contents.cc +++ b/atom/browser/api/atom_api_web_contents.cc @@ -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(), diff --git a/atom/browser/api/atom_api_web_contents.h b/atom/browser/api/atom_api_web_contents.h index eb69d65bf9..5e9a93e3b5 100644 --- a/atom/browser/api/atom_api_web_contents.h +++ b/atom/browser/api/atom_api_web_contents.h @@ -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;