Chromium Code Reviews| 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 "ash/metrics/user_metrics_recorder.h" | 7 #include "ash/metrics/user_metrics_recorder.h" |
| 8 #include "ash/root_window_controller.h" | 8 #include "ash/root_window_controller.h" |
| 9 #include "ash/session_state_delegate.h" | 9 #include "ash/session_state_delegate.h" |
| 10 #include "ash/shell.h" | 10 #include "ash/shell.h" |
| 11 #include "ash/wm/mru_window_tracker.h" | 11 #include "ash/wm/mru_window_tracker.h" |
| 12 #include "ash/wm/overview/window_selector.h" | 12 #include "ash/wm/overview/window_selector.h" |
| 13 #include "ash/wm/window_state.h" | 13 #include "ash/wm/window_state.h" |
| 14 #include "ash/wm/window_util.h" | 14 #include "ash/wm/window_util.h" |
| 15 #include "base/metrics/histogram.h" | 15 #include "base/metrics/histogram.h" |
| 16 #include "ui/aura/window.h" | 16 #include "ui/aura/window.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. | 29 // open. |
| 30 return !Shell::GetInstance()->session_state_delegate()->IsScreenLocked() && | 30 return Shell::GetInstance()->session_state_delegate()-> |
| 31 IsActiveUserSessionStarted() && | |
|
flackr
2014/03/28 16:56:40
Does this work in guest mode too?
jonross
2014/03/28 19:39:01
Yes it does. Verified on device.
| |
| 32 !Shell::GetInstance()->session_state_delegate()->IsScreenLocked() && | |
| 31 !Shell::GetInstance()->IsSystemModalWindowOpen(); | 33 !Shell::GetInstance()->IsSystemModalWindowOpen(); |
| 32 } | 34 } |
| 33 | 35 |
| 34 void WindowSelectorController::ToggleOverview() { | 36 void WindowSelectorController::ToggleOverview() { |
| 35 if (IsSelecting()) { | 37 if (IsSelecting()) { |
| 36 OnSelectionCanceled(); | 38 OnSelectionCanceled(); |
| 37 } else { | 39 } else { |
| 38 std::vector<aura::Window*> windows = ash::Shell::GetInstance()-> | 40 std::vector<aura::Window*> windows = ash::Shell::GetInstance()-> |
| 39 mru_window_tracker()->BuildMruWindowList(); | 41 mru_window_tracker()->BuildMruWindowList(); |
| 40 // Don't enter overview mode with no windows. | 42 // Don't enter overview mode with no windows. |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 88 Shell* shell = Shell::GetInstance(); | 90 Shell* shell = Shell::GetInstance(); |
| 89 shell->metrics()->RecordUserMetricsAction(UMA_WINDOW_SELECTION); | 91 shell->metrics()->RecordUserMetricsAction(UMA_WINDOW_SELECTION); |
| 90 if (!last_selection_time_.is_null()) { | 92 if (!last_selection_time_.is_null()) { |
| 91 UMA_HISTOGRAM_LONG_TIMES( | 93 UMA_HISTOGRAM_LONG_TIMES( |
| 92 "Ash.WindowSelector.TimeBetweenUse", | 94 "Ash.WindowSelector.TimeBetweenUse", |
| 93 base::Time::Now() - last_selection_time_); | 95 base::Time::Now() - last_selection_time_); |
| 94 } | 96 } |
| 95 } | 97 } |
| 96 | 98 |
| 97 } // namespace ash | 99 } // namespace ash |
| OLD | NEW |