diff options
author | jackhou <jackhou@chromium.org> | 2015-06-10 20:50:46 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-06-11 03:51:27 +0000 |
commit | 094d214d67451e91a2a2cb0e9ca248e2873be5ec (patch) | |
tree | 06978aaef064e99ea0bb2ce04f1ac19d3c24cae3 /extensions/browser/app_window | |
parent | fd4170a84c32f3e7b43525f4ea3765a1393039df (diff) | |
download | chromium_src-094d214d67451e91a2a2cb0e9ca248e2873be5ec.zip chromium_src-094d214d67451e91a2a2cb0e9ca248e2873be5ec.tar.gz chromium_src-094d214d67451e91a2a2cb0e9ca248e2873be5ec.tar.bz2 |
[MacViews] Update AppWindow when the native window changes fullscreen state.
This is necessary on Mac because the window can be made fullscreen without
calling through AppWindow::OSFullscreen.
BUG=459877
Review URL: https://codereview.chromium.org/1172483003
Cr-Commit-Position: refs/heads/master@{#333884}
Diffstat (limited to 'extensions/browser/app_window')
-rw-r--r-- | extensions/browser/app_window/app_window.cc | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/extensions/browser/app_window/app_window.cc b/extensions/browser/app_window/app_window.cc index 4aa2dea..77da594 100644 --- a/extensions/browser/app_window/app_window.cc +++ b/extensions/browser/app_window/app_window.cc @@ -458,17 +458,35 @@ void AppWindow::OnNativeClose() { } void AppWindow::OnNativeWindowChanged() { + // This may be called during Init before |native_app_window_| is set. + if (!native_app_window_) + return; + +#if defined(OS_MACOSX) + // On Mac the user can change the window's fullscreen state. If that has + // happened, update AppWindow's internal state. + if (native_app_window_->IsFullscreen()) { + if (!IsFullscreen()) + fullscreen_types_ = FULLSCREEN_TYPE_OS; + } else { + fullscreen_types_ = FULLSCREEN_TYPE_NONE; + } + + if (cached_always_on_top_) + UpdateNativeAlwaysOnTop(); // Same as in SetNativeWindowFullscreen. +#endif + SaveWindowPosition(); #if defined(OS_WIN) - if (native_app_window_ && cached_always_on_top_ && !IsFullscreen() && + if (cached_always_on_top_ && !IsFullscreen() && !native_app_window_->IsMaximized() && !native_app_window_->IsMinimized()) { UpdateNativeAlwaysOnTop(); } #endif - if (app_window_contents_ && native_app_window_) + if (app_window_contents_) app_window_contents_->NativeWindowChanged(native_app_window_.get()); } @@ -964,10 +982,9 @@ WebContentsModalDialogHost* AppWindow::GetWebContentsModalDialogHost() { } void AppWindow::SaveWindowPosition() { + DCHECK(native_app_window_); if (window_key_.empty()) return; - if (!native_app_window_) - return; AppWindowGeometryCache* cache = AppWindowGeometryCache::Get(browser_context()); |