SetFullScreen should not work at all when not fullscreenable

This follows the logic of OS X.
This commit is contained in:
Cheng Zhao 2016-03-05 21:38:06 +09:00
parent f5d79677fa
commit 2be368bded

View file

@ -363,29 +363,27 @@ bool NativeWindowViews::IsMinimized() {
} }
void NativeWindowViews::SetFullScreen(bool fullscreen) { void NativeWindowViews::SetFullScreen(bool fullscreen) {
if (!IsFullScreenable())
return;
#if defined(OS_WIN) #if defined(OS_WIN)
// There is no native fullscreen state on Windows. // There is no native fullscreen state on Windows.
if (fullscreen) { if (fullscreen) {
if (IsFullScreenable()) { last_window_state_ = ui::SHOW_STATE_FULLSCREEN;
last_window_state_ = ui::SHOW_STATE_FULLSCREEN; NotifyWindowEnterFullScreen();
NotifyWindowEnterFullScreen();
}
} else { } else {
last_window_state_ = ui::SHOW_STATE_NORMAL; last_window_state_ = ui::SHOW_STATE_NORMAL;
NotifyWindowLeaveFullScreen(); NotifyWindowLeaveFullScreen();
} }
// We set the new value after notifying, so we can handle the size event // We set the new value after notifying, so we can handle the size event
// correctly. // correctly.
if (IsFullScreenable()) window_->SetFullscreen(fullscreen);
window_->SetFullscreen(fullscreen);
#else #else
if (!fullscreen || (fullscreen && IsFullScreenable())) { if (IsVisible())
if (IsVisible()) window_->SetFullscreen(fullscreen);
window_->SetFullscreen(fullscreen); else
else window_->native_widget_private()->ShowWithWindowState(
window_->native_widget_private()->ShowWithWindowState( ui::SHOW_STATE_FULLSCREEN);
ui::SHOW_STATE_FULLSCREEN);
}
#endif #endif
} }