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

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

Issue 2864663002: cros: Merge SystemTrayDelegate::GetUserLoginStatus (Closed)
Patch Set: Created 3 years, 7 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/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->login_status() != LoginStatus::KIOSK_APP &&
45 system_tray_delegate->GetUserLoginStatus() != 42 session_controller->login_status() != LoginStatus::ARC_KIOSK_APP;
46 LoginStatus::ARC_KIOSK_APP;
47 } 43 }
48 44
49 bool WindowSelectorController::ToggleOverview() { 45 bool WindowSelectorController::ToggleOverview() {
50 if (IsSelecting()) { 46 if (IsSelecting()) {
51 OnSelectionEnded(); 47 OnSelectionEnded();
52 } else { 48 } else {
53 // Don't start overview if window selection is not allowed. 49 // Don't start overview if window selection is not allowed.
54 if (!CanSelect()) 50 if (!CanSelect())
55 return false; 51 return false;
56 52
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 } 123 }
128 124
129 void WindowSelectorController::OnSelectionStarted() { 125 void WindowSelectorController::OnSelectionStarted() {
130 if (!last_selection_time_.is_null()) { 126 if (!last_selection_time_.is_null()) {
131 UMA_HISTOGRAM_LONG_TIMES("Ash.WindowSelector.TimeBetweenUse", 127 UMA_HISTOGRAM_LONG_TIMES("Ash.WindowSelector.TimeBetweenUse",
132 base::Time::Now() - last_selection_time_); 128 base::Time::Now() - last_selection_time_);
133 } 129 }
134 } 130 }
135 131
136 } // namespace ash 132 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698