Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(987)

Unified Diff: ui/wm/core/window_util.cc

Issue 2625113004: Unify window fullscreen and minimizing implementation (Closed)
Patch Set: Fix review issue Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/wm/core/window_util.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/wm/core/window_util.cc
diff --git a/ui/wm/core/window_util.cc b/ui/wm/core/window_util.cc
index 39fa162969b966ccbbee172c43f5c6cde6b85117..58e488594402bb5a407fbe47573604d8aa916e4c 100644
--- a/ui/wm/core/window_util.cc
+++ b/ui/wm/core/window_util.cc
@@ -5,6 +5,7 @@
#include "ui/wm/core/window_util.h"
#include "base/memory/ptr_util.h"
+#include "ui/aura/client/aura_constants.h"
#include "ui/aura/window.h"
#include "ui/compositor/layer.h"
#include "ui/compositor/layer_tree_owner.h"
@@ -84,6 +85,39 @@ bool CanActivateWindow(aura::Window* window) {
return client && client->CanActivateWindow(window);
}
+void SetWindowFullscreen(aura::Window* window, bool fullscreen) {
+ DCHECK(window);
+ ui::WindowShowState current_show_state =
+ window->GetProperty(aura::client::kShowStateKey);
+ bool is_fullscreen = current_show_state == ui::SHOW_STATE_FULLSCREEN;
+ if (fullscreen == is_fullscreen)
+ return;
+ if (fullscreen) {
+ // Save the previous show state so that we can correctly restore it after
+ // exiting the fullscreen mode.
+ ui::WindowShowState pre_show_state = current_show_state;
+ // If the previous show state is ui::SHOW_STATE_MINIMIZED, we will use
+ // the show state before the window was minimized. But if the window was
+ // fullscreen before it was minimized, we will keep the
+ // PreMinimizedShowState unchanged.
+ if (pre_show_state == ui::SHOW_STATE_MINIMIZED) {
+ pre_show_state =
+ window->GetProperty(aura::client::kPreMinimizedShowStateKey);
+ }
+ if (pre_show_state != ui::SHOW_STATE_FULLSCREEN) {
+ window->SetProperty(aura::client::kPreFullscreenShowStateKey,
+ pre_show_state);
+ }
+ window->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_FULLSCREEN);
+ } else {
+ ui::WindowShowState pre_fullscreen_show_state =
+ window->GetProperty(aura::client::kPreFullscreenShowStateKey);
+ DCHECK_NE(pre_fullscreen_show_state, ui::SHOW_STATE_MINIMIZED);
+ window->SetProperty(aura::client::kShowStateKey, pre_fullscreen_show_state);
+ window->ClearProperty(aura::client::kPreFullscreenShowStateKey);
+ }
+}
+
aura::Window* GetActivatableWindow(aura::Window* window) {
aura::client::ActivationClient* client =
aura::client::GetActivationClient(window->GetRootWindow());
« no previous file with comments | « ui/wm/core/window_util.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698