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/session_state_delegate.h" | 9 #include "ash/session_state_delegate.h" |
10 #include "ash/shell.h" | 10 #include "ash/shell.h" |
(...skipping 13 matching lines...) Expand all Loading... |
24 bool IsCyclingAllowed() { | 24 bool IsCyclingAllowed() { |
25 // Cycling is disabled if the screen is locked or a modal dialog is open. | 25 // Cycling is disabled if the screen is locked or a modal dialog is open. |
26 return !Shell::GetInstance()->session_state_delegate()->IsScreenLocked() && | 26 return !Shell::GetInstance()->session_state_delegate()->IsScreenLocked() && |
27 !Shell::GetInstance()->IsSystemModalWindowOpen(); | 27 !Shell::GetInstance()->IsSystemModalWindowOpen(); |
28 } | 28 } |
29 | 29 |
30 } // namespace | 30 } // namespace |
31 | 31 |
32 WorkspaceCycler::WorkspaceCycler(WorkspaceManager* workspace_manager) | 32 WorkspaceCycler::WorkspaceCycler(WorkspaceManager* workspace_manager) |
33 : workspace_manager_(workspace_manager), | 33 : workspace_manager_(workspace_manager), |
34 animator_(NULL), | |
35 state_(NOT_CYCLING), | 34 state_(NOT_CYCLING), |
36 scroll_x_(0.0f), | 35 scroll_x_(0.0f), |
37 scroll_y_(0.0f) { | 36 scroll_y_(0.0f) { |
38 ash::Shell::GetInstance()->AddPreTargetHandler(this); | 37 ash::Shell::GetInstance()->AddPreTargetHandler(this); |
39 } | 38 } |
40 | 39 |
41 WorkspaceCycler::~WorkspaceCycler() { | 40 WorkspaceCycler::~WorkspaceCycler() { |
42 SetState(NOT_CYCLING); | 41 SetState(NOT_CYCLING); |
43 ash::Shell::GetInstance()->RemovePreTargetHandler(this); | 42 ash::Shell::GetInstance()->RemovePreTargetHandler(this); |
44 } | 43 } |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 animator_.reset(); | 170 animator_.reset(); |
172 SetState(NOT_CYCLING); | 171 SetState(NOT_CYCLING); |
173 | 172 |
174 // 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 |
175 // AbortCycling() as a result of SetActiveWorkspaceFromCycler() is a noop. | 174 // AbortCycling() as a result of SetActiveWorkspaceFromCycler() is a noop. |
176 workspace_manager_->SetActiveWorkspaceFromCycler(workspace_to_activate); | 175 workspace_manager_->SetActiveWorkspaceFromCycler(workspace_to_activate); |
177 } | 176 } |
178 | 177 |
179 } // namespace internal | 178 } // namespace internal |
180 } // namespace ash | 179 } // namespace ash |
OLD | NEW |