Chromium Code Reviews| Index: ash/wm/window_state.cc |
| diff --git a/ash/wm/window_state.cc b/ash/wm/window_state.cc |
| index 2afba08d68f104fde02c523099d592422e59e859..e596dc1aadbeceb25c44805bf6ac415390ec30cd 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" |
| @@ -37,6 +38,7 @@ WindowState::WindowState(aura::Window* window) |
| can_consume_system_keys_(false), |
| top_row_keys_are_function_keys_(false), |
| always_restores_to_restore_bounds_(false), |
| + animate_to_fullscreen_(true), |
| window_show_type_(ToWindowShowType(GetShowState())) { |
| window_->AddObserver(this); |
| } |
| @@ -44,6 +46,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); |
| } |
| @@ -154,6 +161,17 @@ void WindowState::ToggleMaximized() { |
| Maximize(); |
| } |
| +void WindowState::ToggleFullscreen() { |
|
pkotwicz
2013/10/26 03:46:34
You probably want to check CanMaximize() in this f
oshima
2013/10/28 22:57:51
Good point. Done.
|
| + if (delegate_ && delegate_->ToggleFullscreen(this)) |
| + return; |
| + if (IsFullscreen()) { |
| + 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 = |