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

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

Issue 2780943002: Enables ScreenPinningController for mash/mus (Closed)
Patch Set: local Created 3 years, 8 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_controller.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 "ash/wm/screen_pinning_controller.h"
17 #include "base/metrics/histogram_macros.h" 18 #include "base/metrics/histogram_macros.h"
18 19
19 namespace ash { 20 namespace ash {
20 21
21 WindowSelectorController::WindowSelectorController() {} 22 WindowSelectorController::WindowSelectorController() {}
22 23
23 WindowSelectorController::~WindowSelectorController() { 24 WindowSelectorController::~WindowSelectorController() {
24 // 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
25 // exiting overview mode. 26 // exiting overview mode.
26 for (std::unique_ptr<DelayedAnimationObserver>& animation_observer : 27 for (std::unique_ptr<DelayedAnimationObserver>& animation_observer :
27 delayed_animations_) { 28 delayed_animations_) {
28 animation_observer->Shutdown(); 29 animation_observer->Shutdown();
29 } 30 }
30 } 31 }
31 32
32 // static 33 // static
33 bool WindowSelectorController::CanSelect() { 34 bool WindowSelectorController::CanSelect() {
34 // 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
35 // open or running in kiosk app session. 36 // open or running in kiosk app session.
36 SessionController* session_controller = Shell::Get()->session_controller(); 37 SessionController* session_controller = Shell::Get()->session_controller();
37 SystemTrayDelegate* system_tray_delegate = 38 SystemTrayDelegate* system_tray_delegate =
38 Shell::Get()->system_tray_delegate(); 39 Shell::Get()->system_tray_delegate();
39 WmShell* wm_shell = WmShell::Get();
40 return session_controller->IsActiveUserSessionStarted() && 40 return session_controller->IsActiveUserSessionStarted() &&
41 !session_controller->IsScreenLocked() && 41 !session_controller->IsScreenLocked() &&
42 !wm_shell->IsSystemModalWindowOpen() && !wm_shell->IsPinned() && 42 !WmShell::Get()->IsSystemModalWindowOpen() &&
43 !Shell::Get()->screen_pinning_controller()->IsPinned() &&
43 system_tray_delegate->GetUserLoginStatus() != LoginStatus::KIOSK_APP && 44 system_tray_delegate->GetUserLoginStatus() != LoginStatus::KIOSK_APP &&
44 system_tray_delegate->GetUserLoginStatus() != 45 system_tray_delegate->GetUserLoginStatus() !=
45 LoginStatus::ARC_KIOSK_APP; 46 LoginStatus::ARC_KIOSK_APP;
46 } 47 }
47 48
48 bool WindowSelectorController::ToggleOverview() { 49 bool WindowSelectorController::ToggleOverview() {
49 if (IsSelecting()) { 50 if (IsSelecting()) {
50 OnSelectionEnded(); 51 OnSelectionEnded();
51 } else { 52 } else {
52 // Don't start overview if window selection is not allowed. 53 // Don't start overview if window selection is not allowed.
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 } 127 }
127 128
128 void WindowSelectorController::OnSelectionStarted() { 129 void WindowSelectorController::OnSelectionStarted() {
129 if (!last_selection_time_.is_null()) { 130 if (!last_selection_time_.is_null()) {
130 UMA_HISTOGRAM_LONG_TIMES("Ash.WindowSelector.TimeBetweenUse", 131 UMA_HISTOGRAM_LONG_TIMES("Ash.WindowSelector.TimeBetweenUse",
131 base::Time::Now() - last_selection_time_); 132 base::Time::Now() - last_selection_time_);
132 } 133 }
133 } 134 }
134 135
135 } // namespace ash 136 } // namespace ash
OLDNEW
« no previous file with comments | « ash/common/wm/maximize_mode/maximize_mode_window_state.cc ('k') | ash/common/wm/window_cycle_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698