OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/overview/window_selector_controller.h" | 5 #include "ash/wm/overview/window_selector_controller.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "ash/common/session/session_state_delegate.h" | 9 #include "ash/common/session/session_state_delegate.h" |
10 #include "ash/common/wm/window_state.h" | 10 #include "ash/common/wm/window_state.h" |
11 #include "ash/common/wm_shell.h" | 11 #include "ash/common/wm_shell.h" |
12 #include "ash/common/wm_window.h" | 12 #include "ash/common/wm_window.h" |
13 #include "ash/shell.h" | 13 #include "ash/shell.h" |
14 #include "ash/system/tray/system_tray_delegate.h" | 14 #include "ash/system/tray/system_tray_delegate.h" |
15 #include "ash/wm/overview/window_selector.h" | 15 #include "ash/wm/overview/window_selector.h" |
16 #include "base/metrics/histogram.h" | 16 #include "base/metrics/histogram.h" |
17 | 17 |
18 namespace ash { | 18 namespace ash { |
19 | 19 |
20 WindowSelectorController::WindowSelectorController() { | 20 WindowSelectorController::WindowSelectorController() { |
21 } | 21 } |
22 | 22 |
23 WindowSelectorController::~WindowSelectorController() { | 23 WindowSelectorController::~WindowSelectorController() { |
24 } | 24 } |
25 | 25 |
26 // static | 26 // static |
27 bool WindowSelectorController::CanSelect() { | 27 bool WindowSelectorController::CanSelect() { |
28 // Don't allow a window overview if the screen is locked or a modal dialog is | 28 // Don't allow a window overview if the screen is locked or a modal dialog is |
29 // open or running in kiosk app session. | 29 // open or running in kiosk app session. |
30 return Shell::GetInstance()->session_state_delegate()-> | 30 return Shell::GetInstance() |
31 IsActiveUserSessionStarted() && | 31 ->session_state_delegate() |
| 32 ->IsActiveUserSessionStarted() && |
32 !Shell::GetInstance()->session_state_delegate()->IsScreenLocked() && | 33 !Shell::GetInstance()->session_state_delegate()->IsScreenLocked() && |
33 !Shell::GetInstance()->IsSystemModalWindowOpen() && | 34 !Shell::GetInstance()->IsSystemModalWindowOpen() && |
34 Shell::GetInstance()->system_tray_delegate()->GetUserLoginStatus() != | 35 Shell::GetInstance()->system_tray_delegate()->GetUserLoginStatus() != |
35 user::LOGGED_IN_KIOSK_APP; | 36 LoginStatus::KIOSK_APP; |
36 } | 37 } |
37 | 38 |
38 void WindowSelectorController::ToggleOverview() { | 39 void WindowSelectorController::ToggleOverview() { |
39 if (IsSelecting()) { | 40 if (IsSelecting()) { |
40 OnSelectionEnded(); | 41 OnSelectionEnded(); |
41 } else { | 42 } else { |
42 // Don't start overview if window selection is not allowed. | 43 // Don't start overview if window selection is not allowed. |
43 if (!CanSelect()) | 44 if (!CanSelect()) |
44 return; | 45 return; |
45 | 46 |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 | 81 |
81 void WindowSelectorController::OnSelectionStarted() { | 82 void WindowSelectorController::OnSelectionStarted() { |
82 if (!last_selection_time_.is_null()) { | 83 if (!last_selection_time_.is_null()) { |
83 UMA_HISTOGRAM_LONG_TIMES( | 84 UMA_HISTOGRAM_LONG_TIMES( |
84 "Ash.WindowSelector.TimeBetweenUse", | 85 "Ash.WindowSelector.TimeBetweenUse", |
85 base::Time::Now() - last_selection_time_); | 86 base::Time::Now() - last_selection_time_); |
86 } | 87 } |
87 } | 88 } |
88 | 89 |
89 } // namespace ash | 90 } // namespace ash |
OLD | NEW |