Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(135)

Side by Side Diff: ash/common/wm/overview/window_selector_controller.cc

Issue 2734933004: ash: Use SessionController instead of SessionStateDelegate (Closed)
Patch Set: rebase to get WorkspaceLayoutManagerSoloTest change Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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_controller.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/overview/window_selector.h"
13 #include "ash/common/wm/window_state.h" 13 #include "ash/common/wm/window_state.h"
14 #include "ash/common/wm_shell.h" 14 #include "ash/common/wm_shell.h"
15 #include "ash/common/wm_window.h" 15 #include "ash/common/wm_window.h"
16 #include "ash/shell.h" 16 #include "ash/shell.h"
17 #include "base/metrics/histogram_macros.h" 17 #include "base/metrics/histogram_macros.h"
18 18
19 namespace ash { 19 namespace ash {
20 20
21 WindowSelectorController::WindowSelectorController() {} 21 WindowSelectorController::WindowSelectorController() {}
22 22
23 WindowSelectorController::~WindowSelectorController() { 23 WindowSelectorController::~WindowSelectorController() {
24 // 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
25 // exiting overview mode. 25 // exiting overview mode.
26 for (std::unique_ptr<DelayedAnimationObserver>& animation_observer : 26 for (std::unique_ptr<DelayedAnimationObserver>& animation_observer :
27 delayed_animations_) { 27 delayed_animations_) {
28 animation_observer->Shutdown(); 28 animation_observer->Shutdown();
29 } 29 }
30 } 30 }
31 31
32 // static 32 // static
33 bool WindowSelectorController::CanSelect() { 33 bool WindowSelectorController::CanSelect() {
34 // 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
35 // open or running in kiosk app session. 35 // open or running in kiosk app session.
36 WmShell* wm_shell = WmShell::Get(); 36 WmShell* wm_shell = WmShell::Get();
37 SessionStateDelegate* session_state_delegate = 37 SessionController* session_controller = wm_shell->session_controller();
38 wm_shell->GetSessionStateDelegate();
39 SystemTrayDelegate* system_tray_delegate = wm_shell->system_tray_delegate(); 38 SystemTrayDelegate* system_tray_delegate = wm_shell->system_tray_delegate();
40 return session_state_delegate->IsActiveUserSessionStarted() && 39 return session_controller->IsActiveUserSessionStarted() &&
41 !session_state_delegate->IsScreenLocked() && 40 !session_controller->IsScreenLocked() &&
42 !wm_shell->IsSystemModalWindowOpen() && !wm_shell->IsPinned() && 41 !wm_shell->IsSystemModalWindowOpen() && !wm_shell->IsPinned() &&
43 system_tray_delegate->GetUserLoginStatus() != LoginStatus::KIOSK_APP && 42 system_tray_delegate->GetUserLoginStatus() != LoginStatus::KIOSK_APP &&
44 system_tray_delegate->GetUserLoginStatus() != 43 system_tray_delegate->GetUserLoginStatus() !=
45 LoginStatus::ARC_KIOSK_APP; 44 LoginStatus::ARC_KIOSK_APP;
46 } 45 }
47 46
48 bool WindowSelectorController::ToggleOverview() { 47 bool WindowSelectorController::ToggleOverview() {
49 if (IsSelecting()) { 48 if (IsSelecting()) {
50 OnSelectionEnded(); 49 OnSelectionEnded();
51 } else { 50 } else {
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 } 125 }
127 126
128 void WindowSelectorController::OnSelectionStarted() { 127 void WindowSelectorController::OnSelectionStarted() {
129 if (!last_selection_time_.is_null()) { 128 if (!last_selection_time_.is_null()) {
130 UMA_HISTOGRAM_LONG_TIMES("Ash.WindowSelector.TimeBetweenUse", 129 UMA_HISTOGRAM_LONG_TIMES("Ash.WindowSelector.TimeBetweenUse",
131 base::Time::Now() - last_selection_time_); 130 base::Time::Now() - last_selection_time_);
132 } 131 }
133 } 132 }
134 133
135 } // namespace ash 134 } // namespace ash
OLDNEW
« no previous file with comments | « ash/common/wm/maximize_mode/maximize_mode_event_handler.cc ('k') | ash/common/wm/system_modal_container_layout_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698