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 "ash/shelf/shelf_layout_manager.h" | 7 #include "ash/shelf/shelf_layout_manager.h" |
8 #include "ash/shell.h" | 8 #include "ash/shell.h" |
9 #include "ash/shell_window_ids.h" | 9 #include "ash/shell_window_ids.h" |
10 #include "ash/wm/base_layout_manager.h" | 10 #include "ash/wm/base_layout_manager.h" |
11 #include "ash/wm/property_util.h" | 11 #include "ash/wm/property_util.h" |
| 12 #include "ash/wm/window_animations.h" |
12 #include "ash/wm/window_properties.h" | 13 #include "ash/wm/window_properties.h" |
13 #include "ash/wm/window_util.h" | 14 #include "ash/wm/window_util.h" |
14 #include "ash/wm/workspace/workspace_animations.h" | |
15 #include "ash/wm/workspace/workspace_event_handler.h" | 15 #include "ash/wm/workspace/workspace_event_handler.h" |
16 #include "ash/wm/workspace/workspace_layout_manager.h" | 16 #include "ash/wm/workspace/workspace_layout_manager.h" |
17 #include "ui/aura/client/activation_client.h" | 17 #include "ui/aura/client/activation_client.h" |
18 #include "ui/aura/client/aura_constants.h" | 18 #include "ui/aura/client/aura_constants.h" |
19 #include "ui/aura/root_window.h" | 19 #include "ui/aura/root_window.h" |
20 #include "ui/aura/window.h" | 20 #include "ui/aura/window.h" |
| 21 #include "ui/compositor/layer.h" |
| 22 #include "ui/compositor/scoped_layer_animation_settings.h" |
21 #include "ui/views/corewm/visibility_controller.h" | 23 #include "ui/views/corewm/visibility_controller.h" |
22 #include "ui/views/corewm/window_animations.h" | 24 #include "ui/views/corewm/window_animations.h" |
23 | 25 |
24 namespace ash { | 26 namespace ash { |
25 namespace internal { | 27 namespace internal { |
26 namespace { | 28 namespace { |
27 | 29 |
28 // Amount of time to pause before animating anything. Only used during initial | 30 // Amount of time to pause before animating anything. Only used during initial |
29 // animation (when logging in). | 31 // animation (when logging in). |
30 const int kInitialPauseTimeMS = 750; | 32 const int kInitialPauseTimeMS = 750; |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 WORKSPACE_WINDOW_STATE_WINDOW_OVERLAPS_SHELF : | 89 WORKSPACE_WINDOW_STATE_WINDOW_OVERLAPS_SHELF : |
88 WORKSPACE_WINDOW_STATE_DEFAULT; | 90 WORKSPACE_WINDOW_STATE_DEFAULT; |
89 } | 91 } |
90 | 92 |
91 void WorkspaceController::SetShelf(ShelfLayoutManager* shelf) { | 93 void WorkspaceController::SetShelf(ShelfLayoutManager* shelf) { |
92 shelf_ = shelf; | 94 shelf_ = shelf; |
93 layout_manager_->SetShelf(shelf); | 95 layout_manager_->SetShelf(shelf); |
94 } | 96 } |
95 | 97 |
96 void WorkspaceController::DoInitialAnimation() { | 98 void WorkspaceController::DoInitialAnimation() { |
97 WorkspaceAnimationDetails details; | 99 viewport_->Show(); |
98 details.animate = details.animate_opacity = details.animate_scale = true; | 100 |
99 details.pause_time_ms = kInitialPauseTimeMS; | 101 viewport_->layer()->SetOpacity(0.0f); |
100 ash::internal::ShowWorkspace(viewport_, details); | 102 SetTransformForScaleAnimation( |
| 103 viewport_->layer(), LAYER_SCALE_ANIMATION_ABOVE); |
| 104 |
| 105 // In order for pause to work we need to stop animations. |
| 106 viewport_->layer()->GetAnimator()->StopAnimating(); |
| 107 |
| 108 { |
| 109 ui::ScopedLayerAnimationSettings settings( |
| 110 viewport_->layer()->GetAnimator()); |
| 111 |
| 112 settings.SetPreemptionStrategy(ui::LayerAnimator::ENQUEUE_NEW_ANIMATION); |
| 113 viewport_->layer()->GetAnimator()->SchedulePauseForProperties( |
| 114 base::TimeDelta::FromMilliseconds(kInitialPauseTimeMS), |
| 115 ui::LayerAnimationElement::TRANSFORM, |
| 116 ui::LayerAnimationElement::OPACITY, |
| 117 ui::LayerAnimationElement::BRIGHTNESS, |
| 118 ui::LayerAnimationElement::VISIBILITY, |
| 119 -1); |
| 120 |
| 121 settings.SetTweenType(ui::Tween::EASE_OUT); |
| 122 settings.SetTransitionDuration( |
| 123 base::TimeDelta::FromMilliseconds(kCrossFadeDurationMS)); |
| 124 viewport_->layer()->SetTransform(gfx::Transform()); |
| 125 viewport_->layer()->SetOpacity(1.0f); |
| 126 } |
101 } | 127 } |
102 | 128 |
103 } // namespace internal | 129 } // namespace internal |
104 } // namespace ash | 130 } // namespace ash |
OLD | NEW |