| 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/common/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/system/tray/system_tray_delegate.h" | 10 #include "ash/common/system/tray/system_tray_delegate.h" |
| 11 #include "ash/common/wm/mru_window_tracker.h" | 11 #include "ash/common/wm/mru_window_tracker.h" |
| 12 #include "ash/common/wm/overview/window_selector.h" |
| 12 #include "ash/common/wm/window_state.h" | 13 #include "ash/common/wm/window_state.h" |
| 13 #include "ash/common/wm_shell.h" | 14 #include "ash/common/wm_shell.h" |
| 14 #include "ash/common/wm_window.h" | 15 #include "ash/common/wm_window.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 } | |
| 22 | 21 |
| 23 WindowSelectorController::~WindowSelectorController() { | 22 WindowSelectorController::~WindowSelectorController() {} |
| 24 } | |
| 25 | 23 |
| 26 // static | 24 // static |
| 27 bool WindowSelectorController::CanSelect() { | 25 bool WindowSelectorController::CanSelect() { |
| 28 // Don't allow a window overview if the screen is locked or a modal dialog is | 26 // Don't allow a window overview if the screen is locked or a modal dialog is |
| 29 // open or running in kiosk app session. | 27 // open or running in kiosk app session. |
| 30 SessionStateDelegate* session_state_delegate = | 28 SessionStateDelegate* session_state_delegate = |
| 31 WmShell::Get()->GetSessionStateDelegate(); | 29 WmShell::Get()->GetSessionStateDelegate(); |
| 32 return session_state_delegate->IsActiveUserSessionStarted() && | 30 return session_state_delegate->IsActiveUserSessionStarted() && |
| 33 !session_state_delegate->IsScreenLocked() && | 31 !session_state_delegate->IsScreenLocked() && |
| 34 !WmShell::Get()->IsSystemModalWindowOpen() && | 32 !WmShell::Get()->IsSystemModalWindowOpen() && |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 // windows, so we can remove WindowSelectorDelegate. | 74 // windows, so we can remove WindowSelectorDelegate. |
| 77 void WindowSelectorController::OnSelectionEnded() { | 75 void WindowSelectorController::OnSelectionEnded() { |
| 78 window_selector_->Shutdown(); | 76 window_selector_->Shutdown(); |
| 79 window_selector_.reset(); | 77 window_selector_.reset(); |
| 80 last_selection_time_ = base::Time::Now(); | 78 last_selection_time_ = base::Time::Now(); |
| 81 WmShell::Get()->OnOverviewModeEnded(); | 79 WmShell::Get()->OnOverviewModeEnded(); |
| 82 } | 80 } |
| 83 | 81 |
| 84 void WindowSelectorController::OnSelectionStarted() { | 82 void WindowSelectorController::OnSelectionStarted() { |
| 85 if (!last_selection_time_.is_null()) { | 83 if (!last_selection_time_.is_null()) { |
| 86 UMA_HISTOGRAM_LONG_TIMES( | 84 UMA_HISTOGRAM_LONG_TIMES("Ash.WindowSelector.TimeBetweenUse", |
| 87 "Ash.WindowSelector.TimeBetweenUse", | 85 base::Time::Now() - last_selection_time_); |
| 88 base::Time::Now() - last_selection_time_); | |
| 89 } | 86 } |
| 90 } | 87 } |
| 91 | 88 |
| 92 } // namespace ash | 89 } // namespace ash |
| OLD | NEW |