| 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/common/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" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 for (std::unique_ptr<DelayedAnimationObserver>& animation_observer : | 25 for (std::unique_ptr<DelayedAnimationObserver>& animation_observer : |
| 26 delayed_animations_) { | 26 delayed_animations_) { |
| 27 animation_observer->Shutdown(); | 27 animation_observer->Shutdown(); |
| 28 } | 28 } |
| 29 } | 29 } |
| 30 | 30 |
| 31 // static | 31 // static |
| 32 bool WindowSelectorController::CanSelect() { | 32 bool WindowSelectorController::CanSelect() { |
| 33 // Don't allow a window overview if the screen is locked or a modal dialog is | 33 // Don't allow a window overview if the screen is locked or a modal dialog is |
| 34 // open or running in kiosk app session. | 34 // open or running in kiosk app session. |
| 35 WmShell* wm_shell = WmShell::Get(); |
| 35 SessionStateDelegate* session_state_delegate = | 36 SessionStateDelegate* session_state_delegate = |
| 36 WmShell::Get()->GetSessionStateDelegate(); | 37 wm_shell->GetSessionStateDelegate(); |
| 38 SystemTrayDelegate* system_tray_delegate = wm_shell->system_tray_delegate(); |
| 37 return session_state_delegate->IsActiveUserSessionStarted() && | 39 return session_state_delegate->IsActiveUserSessionStarted() && |
| 38 !session_state_delegate->IsScreenLocked() && | 40 !session_state_delegate->IsScreenLocked() && |
| 39 !WmShell::Get()->IsSystemModalWindowOpen() && | 41 !wm_shell->IsSystemModalWindowOpen() && !wm_shell->IsPinned() && |
| 40 !WmShell::Get()->IsPinned() && | 42 system_tray_delegate->GetUserLoginStatus() != LoginStatus::KIOSK_APP && |
| 41 WmShell::Get()->system_tray_delegate()->GetUserLoginStatus() != | 43 system_tray_delegate->GetUserLoginStatus() != |
| 42 LoginStatus::KIOSK_APP; | 44 LoginStatus::ARC_KIOSK_APP; |
| 43 } | 45 } |
| 44 | 46 |
| 45 bool WindowSelectorController::ToggleOverview() { | 47 bool WindowSelectorController::ToggleOverview() { |
| 46 if (IsSelecting()) { | 48 if (IsSelecting()) { |
| 47 OnSelectionEnded(); | 49 OnSelectionEnded(); |
| 48 } else { | 50 } else { |
| 49 // Don't start overview if window selection is not allowed. | 51 // Don't start overview if window selection is not allowed. |
| 50 if (!CanSelect()) | 52 if (!CanSelect()) |
| 51 return false; | 53 return false; |
| 52 | 54 |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 } | 115 } |
| 114 | 116 |
| 115 void WindowSelectorController::OnSelectionStarted() { | 117 void WindowSelectorController::OnSelectionStarted() { |
| 116 if (!last_selection_time_.is_null()) { | 118 if (!last_selection_time_.is_null()) { |
| 117 UMA_HISTOGRAM_LONG_TIMES("Ash.WindowSelector.TimeBetweenUse", | 119 UMA_HISTOGRAM_LONG_TIMES("Ash.WindowSelector.TimeBetweenUse", |
| 118 base::Time::Now() - last_selection_time_); | 120 base::Time::Now() - last_selection_time_); |
| 119 } | 121 } |
| 120 } | 122 } |
| 121 | 123 |
| 122 } // namespace ash | 124 } // namespace ash |
| OLD | NEW |