adding events to notify fullscreen state

This commit is contained in:
deepak1556 2015-05-17 02:31:30 +05:30
parent ddda8e4197
commit f2d91bc53c
5 changed files with 24 additions and 0 deletions

View file

@ -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");
}

View file

@ -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;

View file

@ -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(

View file

@ -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() {}

View file

@ -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.