auto window = GetWindowFromGuest(source);
if (window) {
window->SetHtmlApiFullscreen(true);
+ window->NotifyWindowEnterHtmlFullScreen();
source->GetRenderViewHost()->WasResized();
Emit("enter-html-full-screen");
}
auto window = GetWindowFromGuest(source);
if (window) {
window->SetHtmlApiFullscreen(false);
+ window->NotifyWindowLeaveHtmlFullScreen();
source->GetRenderViewHost()->WasResized();
Emit("leave-html-full-screen");
}
const content::WebContents* source) const {
auto window = GetWindowFromGuest(source);
if (window)
- return window->IsHtmlApiFullscreen();
+ return window->is_html_api_fullscreen();
else
return false;
}
node_integration_(true),
has_dialog_attached_(false),
html_fullscreen_(false),
+ native_fullscreen_(false),
zoom_factor_(1.0),
weak_factory_(this),
inspectable_web_contents_(
}
}
+void NativeWindow::SetHtmlApiFullscreen(bool enter_fullscreen) {
+ // Window is already in fullscreen mode, save the state.
+ if (enter_fullscreen && IsFullscreen()) {
+ native_fullscreen_ = true;
+ html_fullscreen_ = true;
+ return;
+ }
+
+ // Exit html fullscreen state but not window's fullscreen mode.
+ if (!enter_fullscreen && native_fullscreen_) {
+ html_fullscreen_ = false;
+ return;
+ }
+
+ SetFullScreen(enter_fullscreen);
+ html_fullscreen_ = enter_fullscreen;
+ native_fullscreen_ = false;
+}
+
void NativeWindow::NotifyWindowClosed() {
if (is_closed_)
return;
OnWindowLeaveFullScreen());
}
+void NativeWindow::NotifyWindowEnterHtmlFullScreen() {
+ FOR_EACH_OBSERVER(NativeWindowObserver, observers_,
+ OnWindowEnterHtmlFullScreen());
+}
+
+void NativeWindow::NotifyWindowLeaveHtmlFullScreen() {
+ FOR_EACH_OBSERVER(NativeWindowObserver, observers_,
+ OnWindowLeaveHtmlFullScreen());
+}
+
bool NativeWindow::ShouldCreateWebContents(
content::WebContents* web_contents,
int route_id,
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(
const content::WebContents* source) const {
- return IsHtmlApiFullscreen();
+ return is_html_api_fullscreen();
}
void NativeWindow::BeforeUnloadFired(const base::TimeTicks& proceed_time) {
base::TimeDelta::FromMilliseconds(ms));
}
-void NativeWindow::SetHtmlApiFullscreen(bool enter_fullscreen) {
- // Window is already in fullscreen mode, save the state.
- if (enter_fullscreen && IsFullscreen()) {
- forced_fullscreen_ = true;
- html_fullscreen_ = true;
- return;
- }
-
- // Exit html fullscreen state but not window's fullscreen mode.
- if (!enter_fullscreen && forced_fullscreen_) {
- html_fullscreen_ = false;
- return;
- }
-
- SetFullScreen(enter_fullscreen);
- html_fullscreen_ = enter_fullscreen;
- forced_fullscreen_ = false;
-}
-
void NativeWindow::NotifyWindowUnresponsive() {
window_unresposive_closure_.Cancel();
void NotifyWindowRestore();
void NotifyWindowEnterFullScreen();
void NotifyWindowLeaveFullScreen();
+ void NotifyWindowEnterHtmlFullScreen();
+ void NotifyWindowLeaveHtmlFullScreen();
void AddObserver(NativeWindowObserver* obs) {
observers_.AddObserver(obs);
bool has_frame() const { return has_frame_; }
- bool IsHtmlApiFullscreen() const { return html_fullscreen_; }
+ bool is_html_api_fullscreen() const { return html_fullscreen_; }
void set_has_dialog_attached(bool has_dialog_attached) {
has_dialog_attached_ = has_dialog_attached;
bool html_fullscreen_;
// Whether window is fullscreened by window api.
- bool forced_fullscreen_;
+ bool native_fullscreen_;
// Closure that would be called when window is unresponsive when closing,
// it should be cancelled when we can prove that the window is responsive.