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

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

Issue 844763006: Change overview mode to so that docked panel windows are not grouped together. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Moved restore window animation out of the ScopedTransformOverviewWindow destructor. Created 5 years, 11 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/metrics/user_metrics_recorder.h" 9 #include "ash/metrics/user_metrics_recorder.h"
10 #include "ash/root_window_controller.h" 10 #include "ash/root_window_controller.h"
11 #include "ash/session/session_state_delegate.h" 11 #include "ash/session/session_state_delegate.h"
12 #include "ash/shell.h" 12 #include "ash/shell.h"
13 #include "ash/system/tray/system_tray_delegate.h" 13 #include "ash/system/tray/system_tray_delegate.h"
14 #include "ash/wm/mru_window_tracker.h" 14 #include "ash/wm/mru_window_tracker.h"
15 #include "ash/wm/overview/window_selector.h" 15 #include "ash/wm/overview/window_selector.h"
16 #include "ash/wm/window_state.h" 16 #include "ash/wm/window_state.h"
17 #include "ash/wm/window_util.h" 17 #include "ash/wm/window_util.h"
18 #include "base/metrics/histogram.h" 18 #include "base/metrics/histogram.h"
19 #include "ui/aura/window.h" 19 #include "ui/aura/window.h"
20 20
21 namespace ash { 21 namespace ash {
22 22
23 WindowSelectorController::WindowSelectorController() { 23 WindowSelectorController::WindowSelectorController() {
24 } 24 }
25 25
26 WindowSelectorController::~WindowSelectorController() { 26 WindowSelectorController::~WindowSelectorController() {
27 DCHECK(!IsSelecting());
27 } 28 }
28 29
29 // static 30 // static
30 bool WindowSelectorController::CanSelect() { 31 bool WindowSelectorController::CanSelect() {
31 // Don't allow a window overview if the screen is locked or a modal dialog is 32 // Don't allow a window overview if the screen is locked or a modal dialog is
32 // open or running in kiosk app session. 33 // open or running in kiosk app session.
33 return Shell::GetInstance()->session_state_delegate()-> 34 return Shell::GetInstance()->session_state_delegate()->
34 IsActiveUserSessionStarted() && 35 IsActiveUserSessionStarted() &&
35 !Shell::GetInstance()->session_state_delegate()->IsScreenLocked() && 36 !Shell::GetInstance()->session_state_delegate()->IsScreenLocked() &&
36 !Shell::GetInstance()->IsSystemModalWindowOpen() && 37 !Shell::GetInstance()->IsSystemModalWindowOpen() &&
37 Shell::GetInstance()->system_tray_delegate()->GetUserLoginStatus() != 38 Shell::GetInstance()->system_tray_delegate()->GetUserLoginStatus() !=
38 user::LOGGED_IN_KIOSK_APP; 39 user::LOGGED_IN_KIOSK_APP;
39 } 40 }
40 41
41 void WindowSelectorController::ToggleOverview() { 42 void WindowSelectorController::ToggleOverview() {
42 if (IsSelecting()) { 43 if (IsSelecting()) {
43 OnSelectionEnded(); 44 OnSelectionEnded();
44 } else { 45 } else {
45 // Don't start overview if window selection is not allowed. 46 // Don't start overview if window selection is not allowed.
46 if (!CanSelect()) 47 if (!CanSelect())
47 return; 48 return;
48 49
49 std::vector<aura::Window*> windows = ash::Shell::GetInstance()-> 50 std::vector<aura::Window*> windows = ash::Shell::GetInstance()->
50 mru_window_tracker()->BuildMruWindowList(); 51 mru_window_tracker()->BuildMruWindowList();
51 // Don't enter overview mode with no windows. 52 // Don't enter overview mode with no windows.
52 if (windows.empty()) 53 if (windows.empty())
53 return; 54 return;
54 55
55 window_selector_.reset(new WindowSelector(windows, this)); 56 window_selector_.reset(new WindowSelector(this));
57 window_selector_->Init(windows);
56 OnSelectionStarted(); 58 OnSelectionStarted();
57 } 59 }
58 } 60 }
59 61
60 bool WindowSelectorController::IsSelecting() { 62 bool WindowSelectorController::IsSelecting() {
61 return window_selector_.get() != NULL; 63 return window_selector_.get() != NULL;
62 } 64 }
63 65
66 bool WindowSelectorController::IsRestoringMinimizedWindows() const {
67 return window_selector_.get() != NULL &&
68 window_selector_->restoring_minimized_windows();
69 }
70
64 // TODO(flackr): Make WindowSelectorController observe the activation of 71 // TODO(flackr): Make WindowSelectorController observe the activation of
65 // windows, so we can remove WindowSelectorDelegate. 72 // windows, so we can remove WindowSelectorDelegate.
66 void WindowSelectorController::OnSelectionEnded() { 73 void WindowSelectorController::OnSelectionEnded() {
74 window_selector_->Shutdown();
67 window_selector_.reset(); 75 window_selector_.reset();
68 last_selection_time_ = base::Time::Now(); 76 last_selection_time_ = base::Time::Now();
69 } 77 }
70 78
71 void WindowSelectorController::OnSelectionStarted() { 79 void WindowSelectorController::OnSelectionStarted() {
72 if (!last_selection_time_.is_null()) { 80 if (!last_selection_time_.is_null()) {
73 UMA_HISTOGRAM_LONG_TIMES( 81 UMA_HISTOGRAM_LONG_TIMES(
74 "Ash.WindowSelector.TimeBetweenUse", 82 "Ash.WindowSelector.TimeBetweenUse",
75 base::Time::Now() - last_selection_time_); 83 base::Time::Now() - last_selection_time_);
76 } 84 }
77 } 85 }
78 86
79 } // namespace ash 87 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698