| 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/session/session_controller.h" | 9 #include "ash/session/session_controller.h" |
| 10 #include "ash/shell.h" | 10 #include "ash/shell.h" |
| 11 #include "ash/shell_port.h" |
| 11 #include "ash/system/tray/system_tray_delegate.h" | 12 #include "ash/system/tray/system_tray_delegate.h" |
| 12 #include "ash/wm/mru_window_tracker.h" | 13 #include "ash/wm/mru_window_tracker.h" |
| 13 #include "ash/wm/overview/window_selector.h" | 14 #include "ash/wm/overview/window_selector.h" |
| 14 #include "ash/wm/screen_pinning_controller.h" | 15 #include "ash/wm/screen_pinning_controller.h" |
| 15 #include "ash/wm/window_state.h" | 16 #include "ash/wm/window_state.h" |
| 16 #include "ash/wm_shell.h" | |
| 17 #include "ash/wm_window.h" | 17 #include "ash/wm_window.h" |
| 18 #include "base/metrics/histogram_macros.h" | 18 #include "base/metrics/histogram_macros.h" |
| 19 | 19 |
| 20 namespace ash { | 20 namespace ash { |
| 21 | 21 |
| 22 WindowSelectorController::WindowSelectorController() {} | 22 WindowSelectorController::WindowSelectorController() {} |
| 23 | 23 |
| 24 WindowSelectorController::~WindowSelectorController() { | 24 WindowSelectorController::~WindowSelectorController() { |
| 25 // Destroy widgets that may be still animating if shell shuts down soon after | 25 // Destroy widgets that may be still animating if shell shuts down soon after |
| 26 // exiting overview mode. | 26 // exiting overview mode. |
| 27 for (std::unique_ptr<DelayedAnimationObserver>& animation_observer : | 27 for (std::unique_ptr<DelayedAnimationObserver>& animation_observer : |
| 28 delayed_animations_) { | 28 delayed_animations_) { |
| 29 animation_observer->Shutdown(); | 29 animation_observer->Shutdown(); |
| 30 } | 30 } |
| 31 } | 31 } |
| 32 | 32 |
| 33 // static | 33 // static |
| 34 bool WindowSelectorController::CanSelect() { | 34 bool WindowSelectorController::CanSelect() { |
| 35 // Don't allow a window overview if the screen is locked or a modal dialog is | 35 // Don't allow a window overview if the screen is locked or a modal dialog is |
| 36 // open or running in kiosk app session. | 36 // open or running in kiosk app session. |
| 37 SessionController* session_controller = Shell::Get()->session_controller(); | 37 SessionController* session_controller = Shell::Get()->session_controller(); |
| 38 SystemTrayDelegate* system_tray_delegate = | 38 SystemTrayDelegate* system_tray_delegate = |
| 39 Shell::Get()->system_tray_delegate(); | 39 Shell::Get()->system_tray_delegate(); |
| 40 return session_controller->IsActiveUserSessionStarted() && | 40 return session_controller->IsActiveUserSessionStarted() && |
| 41 !session_controller->IsScreenLocked() && | 41 !session_controller->IsScreenLocked() && |
| 42 !WmShell::Get()->IsSystemModalWindowOpen() && | 42 !ShellPort::Get()->IsSystemModalWindowOpen() && |
| 43 !Shell::Get()->screen_pinning_controller()->IsPinned() && | 43 !Shell::Get()->screen_pinning_controller()->IsPinned() && |
| 44 system_tray_delegate->GetUserLoginStatus() != LoginStatus::KIOSK_APP && | 44 system_tray_delegate->GetUserLoginStatus() != LoginStatus::KIOSK_APP && |
| 45 system_tray_delegate->GetUserLoginStatus() != | 45 system_tray_delegate->GetUserLoginStatus() != |
| 46 LoginStatus::ARC_KIOSK_APP; | 46 LoginStatus::ARC_KIOSK_APP; |
| 47 } | 47 } |
| 48 | 48 |
| 49 bool WindowSelectorController::ToggleOverview() { | 49 bool WindowSelectorController::ToggleOverview() { |
| 50 if (IsSelecting()) { | 50 if (IsSelecting()) { |
| 51 OnSelectionEnded(); | 51 OnSelectionEnded(); |
| 52 } else { | 52 } else { |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 } | 127 } |
| 128 | 128 |
| 129 void WindowSelectorController::OnSelectionStarted() { | 129 void WindowSelectorController::OnSelectionStarted() { |
| 130 if (!last_selection_time_.is_null()) { | 130 if (!last_selection_time_.is_null()) { |
| 131 UMA_HISTOGRAM_LONG_TIMES("Ash.WindowSelector.TimeBetweenUse", | 131 UMA_HISTOGRAM_LONG_TIMES("Ash.WindowSelector.TimeBetweenUse", |
| 132 base::Time::Now() - last_selection_time_); | 132 base::Time::Now() - last_selection_time_); |
| 133 } | 133 } |
| 134 } | 134 } |
| 135 | 135 |
| 136 } // namespace ash | 136 } // namespace ash |
| OLD | NEW |