Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ash/wm/window_state.h" | 5 #include "ash/wm/window_state.h" |
| 6 | 6 |
| 7 #include "ash/ash_switches.h" | 7 #include "ash/ash_switches.h" |
| 8 #include "ash/root_window_controller.h" | 8 #include "ash/root_window_controller.h" |
| 9 #include "ash/screen_util.h" | 9 #include "ash/screen_util.h" |
| 10 #include "ash/shell_window_ids.h" | 10 #include "ash/shell_window_ids.h" |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 94 void WindowState::SetDelegate(scoped_ptr<WindowStateDelegate> delegate) { | 94 void WindowState::SetDelegate(scoped_ptr<WindowStateDelegate> delegate) { |
| 95 DCHECK(!delegate_.get()); | 95 DCHECK(!delegate_.get()); |
| 96 delegate_ = delegate.Pass(); | 96 delegate_ = delegate.Pass(); |
| 97 } | 97 } |
| 98 | 98 |
| 99 WindowStateType WindowState::GetStateType() const { | 99 WindowStateType WindowState::GetStateType() const { |
| 100 return current_state_->GetType(); | 100 return current_state_->GetType(); |
| 101 } | 101 } |
| 102 | 102 |
| 103 bool WindowState::IsMinimized() const { | 103 bool WindowState::IsMinimized() const { |
| 104 return GetStateType() == WINDOW_STATE_TYPE_MINIMIZED; | 104 return GetStateType() == WINDOW_STATE_TYPE_MINIMIZED || |
| 105 GetStateType() == WINDOW_STATE_TYPE_DOCKED_MINIMIZED; | |
| 105 } | 106 } |
| 106 | 107 |
| 107 bool WindowState::IsMaximized() const { | 108 bool WindowState::IsMaximized() const { |
| 108 return GetStateType() == WINDOW_STATE_TYPE_MAXIMIZED; | 109 return GetStateType() == WINDOW_STATE_TYPE_MAXIMIZED; |
| 109 } | 110 } |
| 110 | 111 |
| 111 bool WindowState::IsFullscreen() const { | 112 bool WindowState::IsFullscreen() const { |
| 112 return GetStateType() == WINDOW_STATE_TYPE_FULLSCREEN; | 113 return GetStateType() == WINDOW_STATE_TYPE_FULLSCREEN; |
| 113 } | 114 } |
| 114 | 115 |
| 115 bool WindowState::IsMaximizedOrFullscreen() const { | 116 bool WindowState::IsMaximizedOrFullscreen() const { |
| 116 return GetStateType() == WINDOW_STATE_TYPE_FULLSCREEN || | 117 return GetStateType() == WINDOW_STATE_TYPE_FULLSCREEN || |
| 117 GetStateType() == WINDOW_STATE_TYPE_MAXIMIZED; | 118 GetStateType() == WINDOW_STATE_TYPE_MAXIMIZED; |
| 118 } | 119 } |
| 119 | 120 |
| 120 bool WindowState::IsSnapped() const { | 121 bool WindowState::IsSnapped() const { |
| 121 return GetStateType() == WINDOW_STATE_TYPE_LEFT_SNAPPED || | 122 return GetStateType() == WINDOW_STATE_TYPE_LEFT_SNAPPED || |
| 122 GetStateType() == WINDOW_STATE_TYPE_RIGHT_SNAPPED; | 123 GetStateType() == WINDOW_STATE_TYPE_RIGHT_SNAPPED; |
| 123 } | 124 } |
| 124 | 125 |
| 125 bool WindowState::IsNormalStateType() const { | 126 bool WindowState::IsNormalStateType() const { |
| 126 return GetStateType() == WINDOW_STATE_TYPE_NORMAL || | 127 return GetStateType() == WINDOW_STATE_TYPE_NORMAL || |
| 127 GetStateType() == WINDOW_STATE_TYPE_DEFAULT; | 128 GetStateType() == WINDOW_STATE_TYPE_DEFAULT || |
| 129 GetStateType() == WINDOW_STATE_TYPE_DOCKED; | |
|
varkha
2014/09/23 22:35:31
This may make the code simpler elsewhere but may b
dtapuska
2014/09/26 14:17:07
Done.
| |
| 128 } | 130 } |
| 129 | 131 |
| 130 bool WindowState::IsNormalOrSnapped() const { | 132 bool WindowState::IsNormalOrSnapped() const { |
| 131 return IsNormalStateType() || IsSnapped(); | 133 return IsNormalStateType() || IsSnapped() || |
| 134 GetStateType() == WINDOW_STATE_TYPE_DOCKED; | |
|
varkha
2014/09/23 22:35:31
Is this necessary given that DOCKED is a Normal st
dtapuska
2014/09/24 15:21:13
No it isn't needed
dtapuska
2014/09/26 14:17:07
Done.
dtapuska
2014/09/26 14:17:07
Done.
| |
| 132 } | 135 } |
| 133 | 136 |
| 134 bool WindowState::IsActive() const { | 137 bool WindowState::IsActive() const { |
| 135 return IsActiveWindow(window_); | 138 return IsActiveWindow(window_); |
| 136 } | 139 } |
| 137 | 140 |
| 138 bool WindowState::IsDocked() const { | 141 bool WindowState::IsDocked() const { |
| 139 return window_->parent() && | 142 return GetStateType() == WINDOW_STATE_TYPE_DOCKED || |
| 140 window_->parent()->id() == kShellWindowId_DockedContainer; | 143 GetStateType() == WINDOW_STATE_TYPE_DOCKED_MINIMIZED; |
| 141 } | 144 } |
| 142 | 145 |
| 143 bool WindowState::CanMaximize() const { | 146 bool WindowState::CanMaximize() const { |
| 144 return window_->GetProperty(aura::client::kCanMaximizeKey); | 147 return window_->GetProperty(aura::client::kCanMaximizeKey); |
| 145 } | 148 } |
| 146 | 149 |
| 147 bool WindowState::CanMinimize() const { | 150 bool WindowState::CanMinimize() const { |
| 148 RootWindowController* controller = RootWindowController::ForWindow(window_); | 151 RootWindowController* controller = RootWindowController::ForWindow(window_); |
| 149 if (!controller) | 152 if (!controller) |
| 150 return false; | 153 return false; |
| (...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 450 } | 453 } |
| 451 return settings; | 454 return settings; |
| 452 } | 455 } |
| 453 | 456 |
| 454 const WindowState* GetWindowState(const aura::Window* window) { | 457 const WindowState* GetWindowState(const aura::Window* window) { |
| 455 return GetWindowState(const_cast<aura::Window*>(window)); | 458 return GetWindowState(const_cast<aura::Window*>(window)); |
| 456 } | 459 } |
| 457 | 460 |
| 458 } // namespace wm | 461 } // namespace wm |
| 459 } // namespace ash | 462 } // namespace ash |
| OLD | NEW |