diff --git a/atom/browser/api/atom_api_window.cc b/atom/browser/api/atom_api_window.cc index b71499d3699c..252c8f920354 100644 --- a/atom/browser/api/atom_api_window.cc +++ b/atom/browser/api/atom_api_window.cc @@ -132,6 +132,14 @@ void Window::OnWindowLeaveFullScreen() { Emit("leave-full-screen"); } +void Window::OnWindowEnterHtmlFullScreen() { + Emit("enter-html-full-screen"); +} + +void Window::OnWindowLeaveHtmlFullScreen() { + Emit("leave-html-full-screen"); +} + void Window::OnRendererUnresponsive() { Emit("unresponsive"); } diff --git a/atom/browser/api/atom_api_window.h b/atom/browser/api/atom_api_window.h index d5c3ceedd2eb..8aa1ed0988dc 100644 --- a/atom/browser/api/atom_api_window.h +++ b/atom/browser/api/atom_api_window.h @@ -66,6 +66,8 @@ class Window : public mate::EventEmitter, void OnWindowRestore() override; void OnWindowEnterFullScreen() override; void OnWindowLeaveFullScreen() override; + void OnWindowEnterHtmlFullScreen() override; + void OnWindowLeaveHtmlFullScreen() override; void OnRendererUnresponsive() override; void OnRendererResponsive() override; void OnDevToolsFocus() override; diff --git a/atom/browser/native_window.cc b/atom/browser/native_window.cc index 6ba941ff7dde..7d00483b20cc 100644 --- a/atom/browser/native_window.cc +++ b/atom/browser/native_window.cc @@ -700,10 +700,14 @@ void NativeWindow::RendererResponsive(content::WebContents* source) { void NativeWindow::EnterFullscreenModeForTab(content::WebContents* source, const GURL& origin) { SetHtmlApiFullscreen(true); + FOR_EACH_OBSERVER(NativeWindowObserver, observers_, + OnWindowEnterHtmlFullScreen()); } void NativeWindow::ExitFullscreenModeForTab(content::WebContents* source) { SetHtmlApiFullscreen(false); + FOR_EACH_OBSERVER(NativeWindowObserver, observers_, + OnWindowLeaveHtmlFullScreen()); } bool NativeWindow::IsFullscreenForTabOrPending( diff --git a/atom/browser/native_window_observer.h b/atom/browser/native_window_observer.h index aa5824946731..8c09e832a829 100644 --- a/atom/browser/native_window_observer.h +++ b/atom/browser/native_window_observer.h @@ -49,6 +49,8 @@ class NativeWindowObserver { virtual void OnWindowRestore() {} virtual void OnWindowEnterFullScreen() {} virtual void OnWindowLeaveFullScreen() {} + virtual void OnWindowEnterHtmlFullScreen() {} + virtual void OnWindowLeaveHtmlFullScreen() {} // Called when devtools window gets focused. virtual void OnDevToolsFocus() {} diff --git a/docs/api/browser-window.md b/docs/api/browser-window.md index 4eb3eb332737..97844a8690e0 100644 --- a/docs/api/browser-window.md +++ b/docs/api/browser-window.md @@ -179,6 +179,14 @@ Emitted when window enters full screen state. Emitted when window leaves full screen state. +### Event: 'enter-html-full-screen' + +Emitted when window enters full screen state triggered by html api. + +### Event: 'leave-html-full-screen' + +Emitted when window leaves full screen state triggered by html api. + ### Event: 'devtools-opened' Emitted when devtools is opened.