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 28 matching lines...) Expand all Loading... |
39 } | 39 } |
40 | 40 |
41 void WindowSelectorController::ToggleOverview() { | 41 void WindowSelectorController::ToggleOverview() { |
42 if (IsSelecting()) { | 42 if (IsSelecting()) { |
43 OnSelectionEnded(); | 43 OnSelectionEnded(); |
44 } else { | 44 } else { |
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 aura::Window::Windows windows = |
50 mru_window_tracker()->BuildMruWindowList(); | 50 ash::Shell::GetInstance()->mru_window_tracker()->BuildMruWindowList(); |
| 51 auto end = |
| 52 std::remove_if(windows.begin(), windows.end(), |
| 53 std::not1(std::ptr_fun(&WindowSelector::IsSelectable))); |
| 54 windows.resize(end - windows.begin()); |
| 55 |
51 // Don't enter overview mode with no windows. | 56 // Don't enter overview mode with no windows. |
52 if (windows.empty()) | 57 if (windows.empty()) |
53 return; | 58 return; |
54 | 59 |
55 Shell::GetInstance()->OnOverviewModeStarting(); | 60 Shell::GetInstance()->OnOverviewModeStarting(); |
56 window_selector_.reset(new WindowSelector(this)); | 61 window_selector_.reset(new WindowSelector(this)); |
57 window_selector_->Init(windows); | 62 window_selector_->Init(windows); |
58 OnSelectionStarted(); | 63 OnSelectionStarted(); |
59 } | 64 } |
60 } | 65 } |
(...skipping 18 matching lines...) Expand all Loading... |
79 | 84 |
80 void WindowSelectorController::OnSelectionStarted() { | 85 void WindowSelectorController::OnSelectionStarted() { |
81 if (!last_selection_time_.is_null()) { | 86 if (!last_selection_time_.is_null()) { |
82 UMA_HISTOGRAM_LONG_TIMES( | 87 UMA_HISTOGRAM_LONG_TIMES( |
83 "Ash.WindowSelector.TimeBetweenUse", | 88 "Ash.WindowSelector.TimeBetweenUse", |
84 base::Time::Now() - last_selection_time_); | 89 base::Time::Now() - last_selection_time_); |
85 } | 90 } |
86 } | 91 } |
87 | 92 |
88 } // namespace ash | 93 } // namespace ash |
OLD | NEW |