OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/workspace_controller.h" | 5 #include "ash/wm/workspace_controller.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "ash/public/cpp/shell_window_ids.h" | 9 #include "ash/public/cpp/shell_window_ids.h" |
10 #include "ash/root_window_controller.h" | 10 #include "ash/root_window_controller.h" |
11 #include "ash/shelf/shelf.h" | 11 #include "ash/shelf/shelf.h" |
12 #include "ash/shell_port.h" | 12 #include "ash/shell_port.h" |
13 #include "ash/wm/fullscreen_window_finder.h" | 13 #include "ash/wm/fullscreen_window_finder.h" |
14 #include "ash/wm/window_state.h" | 14 #include "ash/wm/window_state.h" |
15 #include "ash/wm/wm_window_animations.h" | 15 #include "ash/wm/wm_window_animations.h" |
16 #include "ash/wm/workspace/backdrop_controller.h" | 16 #include "ash/wm/workspace/backdrop_controller.h" |
17 #include "ash/wm/workspace/backdrop_delegate.h" | 17 #include "ash/wm/workspace/backdrop_delegate.h" |
18 #include "ash/wm/workspace/workspace_event_handler.h" | 18 #include "ash/wm/workspace/workspace_event_handler.h" |
19 #include "ash/wm/workspace/workspace_layout_manager.h" | 19 #include "ash/wm/workspace/workspace_layout_manager.h" |
20 #include "ash/wm_window.h" | |
21 #include "ui/aura/window.h" | 20 #include "ui/aura/window.h" |
22 #include "ui/compositor/layer.h" | 21 #include "ui/compositor/layer.h" |
23 #include "ui/compositor/scoped_layer_animation_settings.h" | 22 #include "ui/compositor/scoped_layer_animation_settings.h" |
| 23 #include "ui/wm/core/window_animations.h" |
24 | 24 |
25 namespace ash { | 25 namespace ash { |
26 namespace { | 26 namespace { |
27 | 27 |
28 // Amount of time to pause before animating anything. Only used during initial | 28 // Amount of time to pause before animating anything. Only used during initial |
29 // animation (when logging in). | 29 // animation (when logging in). |
30 const int kInitialPauseTimeMS = 750; | 30 const int kInitialPauseTimeMS = 750; |
31 | 31 |
32 // The duration of the animation that occurs on first login. | 32 // The duration of the animation that occurs on first login. |
33 const int kInitialAnimationDurationMS = 200; | 33 const int kInitialAnimationDurationMS = 200; |
34 | 34 |
35 } // namespace | 35 } // namespace |
36 | 36 |
37 WorkspaceController::WorkspaceController(aura::Window* viewport) | 37 WorkspaceController::WorkspaceController(aura::Window* viewport) |
38 : viewport_(viewport), | 38 : viewport_(viewport), |
39 event_handler_(ShellPort::Get()->CreateWorkspaceEventHandler( | 39 event_handler_(ShellPort::Get()->CreateWorkspaceEventHandler(viewport)), |
40 WmWindow::Get(viewport))), | |
41 layout_manager_(new WorkspaceLayoutManager(viewport)) { | 40 layout_manager_(new WorkspaceLayoutManager(viewport)) { |
42 viewport_->AddObserver(this); | 41 viewport_->AddObserver(this); |
43 ::wm::SetWindowVisibilityAnimationTransition(viewport_, ::wm::ANIMATE_NONE); | 42 ::wm::SetWindowVisibilityAnimationTransition(viewport_, ::wm::ANIMATE_NONE); |
44 viewport_->SetLayoutManager(layout_manager_); | 43 viewport_->SetLayoutManager(layout_manager_); |
45 } | 44 } |
46 | 45 |
47 WorkspaceController::~WorkspaceController() { | 46 WorkspaceController::~WorkspaceController() { |
48 if (!viewport_) | 47 if (!viewport_) |
49 return; | 48 return; |
50 | 49 |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 void WorkspaceController::OnWindowDestroying(aura::Window* window) { | 117 void WorkspaceController::OnWindowDestroying(aura::Window* window) { |
119 DCHECK_EQ(window, viewport_); | 118 DCHECK_EQ(window, viewport_); |
120 viewport_->RemoveObserver(this); | 119 viewport_->RemoveObserver(this); |
121 viewport_ = nullptr; | 120 viewport_ = nullptr; |
122 // Destroy |event_handler_| too as it depends upon |window|. | 121 // Destroy |event_handler_| too as it depends upon |window|. |
123 event_handler_.reset(); | 122 event_handler_.reset(); |
124 layout_manager_ = nullptr; | 123 layout_manager_ = nullptr; |
125 } | 124 } |
126 | 125 |
127 } // namespace ash | 126 } // namespace ash |
OLD | NEW |