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/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" |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 // Don't start overview if window selection is not allowed. | 45 // Don't start overview if window selection is not allowed. |
46 if (!CanSelect()) | 46 if (!CanSelect()) |
47 return; | 47 return; |
48 | 48 |
49 std::vector<aura::Window*> windows = ash::Shell::GetInstance()-> | 49 std::vector<aura::Window*> windows = ash::Shell::GetInstance()-> |
50 mru_window_tracker()->BuildMruWindowList(); | 50 mru_window_tracker()->BuildMruWindowList(); |
51 // Don't enter overview mode with no windows. | 51 // Don't enter overview mode with no windows. |
52 if (windows.empty()) | 52 if (windows.empty()) |
53 return; | 53 return; |
54 | 54 |
55 window_selector_.reset(new WindowSelector(windows, this)); | 55 Shell::GetInstance()->OnOverviewModeStarting(); |
| 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(); |
| 77 Shell::GetInstance()->OnOverviewModeEnded(); |
69 } | 78 } |
70 | 79 |
71 void WindowSelectorController::OnSelectionStarted() { | 80 void WindowSelectorController::OnSelectionStarted() { |
72 if (!last_selection_time_.is_null()) { | 81 if (!last_selection_time_.is_null()) { |
73 UMA_HISTOGRAM_LONG_TIMES( | 82 UMA_HISTOGRAM_LONG_TIMES( |
74 "Ash.WindowSelector.TimeBetweenUse", | 83 "Ash.WindowSelector.TimeBetweenUse", |
75 base::Time::Now() - last_selection_time_); | 84 base::Time::Now() - last_selection_time_); |
76 } | 85 } |
77 } | 86 } |
78 | 87 |
79 } // namespace ash | 88 } // namespace ash |
OLD | NEW |