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