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 <utility> | 7 #include <utility> |
8 | 8 |
9 #include "ash/public/cpp/window_properties.h" | 9 #include "ash/public/cpp/window_properties.h" |
10 #include "ash/public/interfaces/window_pin_type.mojom.h" | 10 #include "ash/public/interfaces/window_pin_type.mojom.h" |
11 #include "ash/screen_util.h" | 11 #include "ash/screen_util.h" |
12 #include "ash/wm/default_state.h" | 12 #include "ash/wm/default_state.h" |
13 #include "ash/wm/window_positioning_utils.h" | 13 #include "ash/wm/window_positioning_utils.h" |
| 14 #include "ash/wm/window_properties.h" |
14 #include "ash/wm/window_state_delegate.h" | 15 #include "ash/wm/window_state_delegate.h" |
15 #include "ash/wm/window_state_observer.h" | 16 #include "ash/wm/window_state_observer.h" |
| 17 #include "ash/wm/window_util.h" |
16 #include "ash/wm/wm_event.h" | 18 #include "ash/wm/wm_event.h" |
17 #include "ash/wm_window.h" | 19 #include "ash/wm_window.h" |
18 #include "base/auto_reset.h" | 20 #include "base/auto_reset.h" |
19 #include "ui/aura/window.h" | 21 #include "ui/aura/window.h" |
20 | 22 |
21 namespace ash { | 23 namespace ash { |
22 namespace wm { | 24 namespace wm { |
23 | 25 |
24 namespace { | 26 namespace { |
25 | 27 |
(...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
422 // No animation is necessary in that case, thus just change the bounds and | 424 // No animation is necessary in that case, thus just change the bounds and |
423 // quit. | 425 // quit. |
424 if (!window_->GetTargetVisibility()) { | 426 if (!window_->GetTargetVisibility()) { |
425 SetBoundsConstrained(new_bounds); | 427 SetBoundsConstrained(new_bounds); |
426 return; | 428 return; |
427 } | 429 } |
428 | 430 |
429 window_->SetBoundsDirectCrossFade(new_bounds); | 431 window_->SetBoundsDirectCrossFade(new_bounds); |
430 } | 432 } |
431 | 433 |
| 434 WindowState* GetActiveWindowState() { |
| 435 aura::Window* active = GetActiveWindow(); |
| 436 return active ? GetWindowState(active) : nullptr; |
| 437 } |
| 438 |
| 439 WindowState* GetWindowState(aura::Window* window) { |
| 440 if (!window) |
| 441 return nullptr; |
| 442 WindowState* settings = window->GetProperty(kWindowStateKey); |
| 443 if (!settings) { |
| 444 settings = new WindowState(WmWindow::Get(window)); |
| 445 window->SetProperty(kWindowStateKey, settings); |
| 446 } |
| 447 return settings; |
| 448 } |
| 449 |
| 450 const WindowState* GetWindowState(const aura::Window* window) { |
| 451 return GetWindowState(const_cast<aura::Window*>(window)); |
| 452 } |
| 453 |
432 } // namespace wm | 454 } // namespace wm |
433 } // namespace ash | 455 } // namespace ash |
OLD | NEW |