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