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/shell.h" | 10 #include "ash/shell.h" |
10 #include "ash/wm/workspace/workspace_cycler_configuration.h" | 11 #include "ash/wm/workspace/workspace_cycler_configuration.h" |
11 #include "ash/wm/workspace/workspace_manager.h" | 12 #include "ash/wm/workspace/workspace_manager.h" |
12 #include "ui/base/events/event.h" | 13 #include "ui/base/events/event.h" |
13 #include "ui/base/events/event_utils.h" | 14 #include "ui/base/events/event_utils.h" |
14 | 15 |
15 typedef ash::WorkspaceCyclerConfiguration Config; | 16 typedef ash::WorkspaceCyclerConfiguration Config; |
16 | 17 |
17 namespace ash { | 18 namespace ash { |
18 namespace internal { | 19 namespace internal { |
19 | 20 |
20 namespace { | 21 namespace { |
21 | 22 |
22 // Returns true if cycling is allowed. | 23 // Returns true if cycling is allowed. |
23 bool IsCyclingAllowed() { | 24 bool IsCyclingAllowed() { |
24 // 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. |
25 return !Shell::GetInstance()->IsScreenLocked() && | 26 return !Shell::GetInstance()->session_state_delegate()->IsScreenLocked() && |
26 !Shell::GetInstance()->IsSystemModalWindowOpen(); | 27 !Shell::GetInstance()->IsSystemModalWindowOpen(); |
27 } | 28 } |
28 | 29 |
29 } // namespace | 30 } // namespace |
30 | 31 |
31 WorkspaceCycler::WorkspaceCycler(WorkspaceManager* workspace_manager) | 32 WorkspaceCycler::WorkspaceCycler(WorkspaceManager* workspace_manager) |
32 : workspace_manager_(workspace_manager), | 33 : workspace_manager_(workspace_manager), |
33 animator_(NULL), | 34 animator_(NULL), |
34 state_(NOT_CYCLING), | 35 state_(NOT_CYCLING), |
35 scroll_x_(0.0f), | 36 scroll_x_(0.0f), |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 animator_.reset(); | 171 animator_.reset(); |
171 SetState(NOT_CYCLING); | 172 SetState(NOT_CYCLING); |
172 | 173 |
173 // Activate the workspace after updating the state so that a call to | 174 // Activate the workspace after updating the state so that a call to |
174 // AbortCycling() as a result of SetActiveWorkspaceFromCycler() is a noop. | 175 // AbortCycling() as a result of SetActiveWorkspaceFromCycler() is a noop. |
175 workspace_manager_->SetActiveWorkspaceFromCycler(workspace_to_activate); | 176 workspace_manager_->SetActiveWorkspaceFromCycler(workspace_to_activate); |
176 } | 177 } |
177 | 178 |
178 } // namespace internal | 179 } // namespace internal |
179 } // namespace ash | 180 } // namespace ash |
OLD | NEW |