| 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/workspace_cycler.h" | 5 #include "ash/wm/workspace/workspace_cycler.h" |
| 6 | 6 |
| 7 #include <cmath> | 7 #include <cmath> |
| 8 | 8 |
| 9 #include "ash/shell.h" | 9 #include "ash/shell.h" |
| 10 #include "ash/wm/workspace/workspace_cycler_configuration.h" | 10 #include "ash/wm/workspace/workspace_cycler_configuration.h" |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 return; | 54 return; |
| 55 | 55 |
| 56 state_ = new_state; | 56 state_ = new_state; |
| 57 | 57 |
| 58 if (new_state == STARTING_CYCLING) { | 58 if (new_state == STARTING_CYCLING) { |
| 59 animator_.reset(new WorkspaceCyclerAnimator(this)); | 59 animator_.reset(new WorkspaceCyclerAnimator(this)); |
| 60 workspace_manager_->InitWorkspaceCyclerAnimatorWithCurrentState( | 60 workspace_manager_->InitWorkspaceCyclerAnimatorWithCurrentState( |
| 61 animator_.get()); | 61 animator_.get()); |
| 62 animator_->AnimateStartingCycler(); | 62 animator_->AnimateStartingCycler(); |
| 63 } else if (new_state == STOPPING_CYCLING) { | 63 } else if (new_state == STOPPING_CYCLING) { |
| 64 if (animator_.get()) | 64 if (animator_) |
| 65 animator_->AnimateStoppingCycler(); | 65 animator_->AnimateStoppingCycler(); |
| 66 } else if (new_state == NOT_CYCLING) { | 66 } else if (new_state == NOT_CYCLING) { |
| 67 scroll_x_ = 0.0f; | 67 scroll_x_ = 0.0f; |
| 68 scroll_y_ = 0.0f; | 68 scroll_y_ = 0.0f; |
| 69 if (animator_.get()) { | 69 if (animator_) { |
| 70 animator_->AbortAnimations(); | 70 animator_->AbortAnimations(); |
| 71 animator_.reset(); | 71 animator_.reset(); |
| 72 } | 72 } |
| 73 } | 73 } |
| 74 } | 74 } |
| 75 | 75 |
| 76 bool WorkspaceCycler::IsValidNextState(State next_state) const { | 76 bool WorkspaceCycler::IsValidNextState(State next_state) const { |
| 77 if (state_ == next_state) | 77 if (state_ == next_state) |
| 78 return true; | 78 return true; |
| 79 | 79 |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 animator_.reset(); | 170 animator_.reset(); |
| 171 SetState(NOT_CYCLING); | 171 SetState(NOT_CYCLING); |
| 172 | 172 |
| 173 // Activate the workspace after updating the state so that a call to | 173 // Activate the workspace after updating the state so that a call to |
| 174 // AbortCycling() as a result of SetActiveWorkspaceFromCycler() is a noop. | 174 // AbortCycling() as a result of SetActiveWorkspaceFromCycler() is a noop. |
| 175 workspace_manager_->SetActiveWorkspaceFromCycler(workspace_to_activate); | 175 workspace_manager_->SetActiveWorkspaceFromCycler(workspace_to_activate); |
| 176 } | 176 } |
| 177 | 177 |
| 178 } // namespace internal | 178 } // namespace internal |
| 179 } // namespace ash | 179 } // namespace ash |
| OLD | NEW |