Chromium Code Reviews| 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..0c7800dc36c549eb6d7f0fca0ea24b8a0ccb4d3e 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,34 @@ bool CanActivateWindow(aura::Window* window) { |
| return client && client->CanActivateWindow(window); |
| } |
| +void SetWindowFullscreen(aura::Window* window, bool fullscreen) { |
| + DCHECK(window); |
| + auto current_state = window->GetProperty(aura::client::kShowStateKey); |
|
sky
2017/01/24 21:56:33
It isn't obvious what the type is here, please use
Peng
2017/01/24 22:13:03
Done.
|
| + bool is_fullscreen = current_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. |
| + auto pre_state = current_state; |
|
sky
2017/01/24 21:56:33
pre_show_state.
Peng
2017/01/24 22:13:03
Done.
|
| + // 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_state == ui::SHOW_STATE_MINIMIZED) |
| + pre_state = window->GetProperty(aura::client::kPreMinimizedShowStateKey); |
| + if (pre_state != ui::SHOW_STATE_FULLSCREEN) |
| + window->SetProperty(aura::client::kPreFullscreenShowStateKey, pre_state); |
| + window->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_FULLSCREEN); |
| + } else { |
| + auto pre_fullscreen_state = |
|
sky
2017/01/24 21:56:33
pre_fullscreen_show_state. And same comment about
Peng
2017/01/24 22:13:03
Done.
|
| + window->GetProperty(aura::client::kPreFullscreenShowStateKey); |
| + DCHECK_NE(pre_fullscreen_state, ui::SHOW_STATE_MINIMIZED); |
| + window->SetProperty(aura::client::kShowStateKey, pre_fullscreen_state); |
| + window->ClearProperty(aura::client::kPreFullscreenShowStateKey); |
| + } |
| +} |
| + |
| aura::Window* GetActivatableWindow(aura::Window* window) { |
| aura::client::ActivationClient* client = |
| aura::client::GetActivationClient(window->GetRootWindow()); |