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 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 bool WindowState::IsNormalOrSnapped() const { | 143 bool WindowState::IsNormalOrSnapped() const { |
144 return IsNormalStateType() || IsSnapped(); | 144 return IsNormalStateType() || IsSnapped(); |
145 } | 145 } |
146 | 146 |
147 bool WindowState::IsActive() const { | 147 bool WindowState::IsActive() const { |
148 return IsActiveWindow(window_); | 148 return IsActiveWindow(window_); |
149 } | 149 } |
150 | 150 |
151 bool WindowState::IsDocked() const { | 151 bool WindowState::IsDocked() const { |
152 return window_->parent() && | 152 return window_->parent() && |
153 window_->parent()->id() == internal::kShellWindowId_DockedContainer; | 153 window_->parent()->id() == kShellWindowId_DockedContainer; |
154 } | 154 } |
155 | 155 |
156 bool WindowState::CanMaximize() const { | 156 bool WindowState::CanMaximize() const { |
157 return window_->GetProperty(aura::client::kCanMaximizeKey); | 157 return window_->GetProperty(aura::client::kCanMaximizeKey); |
158 } | 158 } |
159 | 159 |
160 bool WindowState::CanMinimize() const { | 160 bool WindowState::CanMinimize() const { |
161 internal::RootWindowController* controller = | 161 RootWindowController* controller = RootWindowController::ForWindow(window_); |
162 internal::RootWindowController::ForWindow(window_); | |
163 if (!controller) | 162 if (!controller) |
164 return false; | 163 return false; |
165 aura::Window* lockscreen = controller->GetContainer( | 164 aura::Window* lockscreen = |
166 internal::kShellWindowId_LockScreenContainersContainer); | 165 controller->GetContainer(kShellWindowId_LockScreenContainersContainer); |
167 if (lockscreen->Contains(window_)) | 166 if (lockscreen->Contains(window_)) |
168 return false; | 167 return false; |
169 | 168 |
170 return true; | 169 return true; |
171 } | 170 } |
172 | 171 |
173 bool WindowState::CanResize() const { | 172 bool WindowState::CanResize() const { |
174 return window_->GetProperty(aura::client::kCanResizeKey); | 173 return window_->GetProperty(aura::client::kCanResizeKey); |
175 } | 174 } |
176 | 175 |
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
411 } | 410 } |
412 | 411 |
413 WindowState* GetActiveWindowState() { | 412 WindowState* GetActiveWindowState() { |
414 aura::Window* active = GetActiveWindow(); | 413 aura::Window* active = GetActiveWindow(); |
415 return active ? GetWindowState(active) : NULL; | 414 return active ? GetWindowState(active) : NULL; |
416 } | 415 } |
417 | 416 |
418 WindowState* GetWindowState(aura::Window* window) { | 417 WindowState* GetWindowState(aura::Window* window) { |
419 if (!window) | 418 if (!window) |
420 return NULL; | 419 return NULL; |
421 WindowState* settings = window->GetProperty(internal::kWindowStateKey); | 420 WindowState* settings = window->GetProperty(kWindowStateKey); |
422 if(!settings) { | 421 if(!settings) { |
423 settings = new WindowState(window); | 422 settings = new WindowState(window); |
424 window->SetProperty(internal::kWindowStateKey, settings); | 423 window->SetProperty(kWindowStateKey, settings); |
425 } | 424 } |
426 return settings; | 425 return settings; |
427 } | 426 } |
428 | 427 |
429 const WindowState* GetWindowState(const aura::Window* window) { | 428 const WindowState* GetWindowState(const aura::Window* window) { |
430 return GetWindowState(const_cast<aura::Window*>(window)); | 429 return GetWindowState(const_cast<aura::Window*>(window)); |
431 } | 430 } |
432 | 431 |
433 } // namespace wm | 432 } // namespace wm |
434 } // namespace ash | 433 } // namespace ash |
OLD | NEW |