diff --git a/atom/browser/api/atom_api_web_contents.cc b/atom/browser/api/atom_api_web_contents.cc index b0f0a95ed2fd..2bd496ffce74 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 eb69d65bf9aa..5e9a93e3b5c2 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;