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" | |
10 #include "ash/shell.h" | 9 #include "ash/shell.h" |
11 #include "ash/wm/workspace/workspace_cycler_configuration.h" | 10 #include "ash/wm/workspace/workspace_cycler_configuration.h" |
12 #include "ash/wm/workspace/workspace_manager.h" | 11 #include "ash/wm/workspace/workspace_manager.h" |
13 #include "ui/base/events/event.h" | 12 #include "ui/base/events/event.h" |
14 #include "ui/base/events/event_utils.h" | 13 #include "ui/base/events/event_utils.h" |
15 | 14 |
16 typedef ash::WorkspaceCyclerConfiguration Config; | 15 typedef ash::WorkspaceCyclerConfiguration Config; |
17 | 16 |
18 namespace ash { | 17 namespace ash { |
19 namespace internal { | 18 namespace internal { |
20 | 19 |
21 namespace { | 20 namespace { |
22 | 21 |
23 // Returns true if cycling is allowed. | 22 // Returns true if cycling is allowed. |
24 bool IsCyclingAllowed() { | 23 bool IsCyclingAllowed() { |
25 // Cycling is disabled if the screen is locked or a modal dialog is open. | 24 // Cycling is disabled if the screen is locked or a modal dialog is open. |
26 return !Shell::GetInstance()->session_state_delegate()->IsScreenLocked() && | 25 return !Shell::GetInstance()->IsScreenLocked() && |
27 !Shell::GetInstance()->IsSystemModalWindowOpen(); | 26 !Shell::GetInstance()->IsSystemModalWindowOpen(); |
28 } | 27 } |
29 | 28 |
30 } // namespace | 29 } // namespace |
31 | 30 |
32 WorkspaceCycler::WorkspaceCycler(WorkspaceManager* workspace_manager) | 31 WorkspaceCycler::WorkspaceCycler(WorkspaceManager* workspace_manager) |
33 : workspace_manager_(workspace_manager), | 32 : workspace_manager_(workspace_manager), |
34 animator_(NULL), | 33 animator_(NULL), |
35 state_(NOT_CYCLING), | 34 state_(NOT_CYCLING), |
36 scroll_x_(0.0f), | 35 scroll_x_(0.0f), |
(...skipping 134 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 |