| Index: ash/wm/window_state.cc
|
| diff --git a/ash/wm/window_state.cc b/ash/wm/window_state.cc
|
| index d037a76c5588ed9b09530a388f4e63a7ea32c376..4d846b8443061177962192118ea266e13b549fd0 100644
|
| --- a/ash/wm/window_state.cc
|
| +++ b/ash/wm/window_state.cc
|
| @@ -8,6 +8,7 @@
|
| #include "ash/screen_ash.h"
|
| #include "ash/shell_window_ids.h"
|
| #include "ash/wm/window_properties.h"
|
| +#include "ash/wm/window_state_delegate.h"
|
| #include "ash/wm/window_state_observer.h"
|
| #include "ash/wm/window_util.h"
|
| #include "ash/wm/wm_types.h"
|
| @@ -39,6 +40,7 @@ WindowState::WindowState(aura::Window* window)
|
| window_resizer_(NULL),
|
| always_restores_to_restore_bounds_(false),
|
| hide_shelf_when_fullscreen_(true),
|
| + animate_to_fullscreen_(true),
|
| window_show_type_(ToWindowShowType(GetShowState())) {
|
| window_->AddObserver(this);
|
| }
|
| @@ -46,6 +48,11 @@ WindowState::WindowState(aura::Window* window)
|
| WindowState::~WindowState() {
|
| }
|
|
|
| +void WindowState::SetDelegate(WindowStateDelegate* delegate) {
|
| + DCHECK(!delegate_.get());
|
| + delegate_.reset(delegate);
|
| +}
|
| +
|
| ui::WindowShowState WindowState::GetShowState() const {
|
| return window_->GetProperty(aura::client::kShowStateKey);
|
| }
|
| @@ -156,6 +163,22 @@ void WindowState::ToggleMaximized() {
|
| Maximize();
|
| }
|
|
|
| +void WindowState::ToggleFullscreen() {
|
| + // Window which cannot be maximized should not be fullscreened.
|
| + // It can, however, be restored if it was fullscreened.
|
| + bool is_fullscreen = IsFullscreen();
|
| + if (!is_fullscreen && !CanMaximize())
|
| + return;
|
| + if (delegate_ && delegate_->ToggleFullscreen(this))
|
| + return;
|
| + if (is_fullscreen) {
|
| + Restore();
|
| + } else {
|
| + window_->SetProperty(aura::client::kShowStateKey,
|
| + ui::SHOW_STATE_FULLSCREEN);
|
| + }
|
| +}
|
| +
|
| void WindowState::SetBoundsInScreen(
|
| const gfx::Rect& bounds_in_screen) {
|
| gfx::Rect bounds_in_parent =
|
|
|