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 | |
52 for (aura::Window::Windows::iterator iter = windows.begin(); | |
flackr
2015/04/07 15:08:39
Use std::remove_if for linear runtime?
oshima
2015/04/07 18:00:32
This is linear too. To use remove_if, I need to ch
flackr
2015/04/07 18:10:33
aura::Window::Windows looks to be a vector making
oshima
2015/04/07 20:35:29
You're absolutely right, sorry. Updated.
| |
53 iter != windows.end();) { | |
54 if (WindowSelector::IsSelectable(*iter)) | |
55 ++iter; | |
56 else | |
57 iter = windows.erase(iter); | |
58 } | |
59 | |
51 // Don't enter overview mode with no windows. | 60 // Don't enter overview mode with no windows. |
52 if (windows.empty()) | 61 if (windows.empty()) |
53 return; | 62 return; |
54 | 63 |
55 Shell::GetInstance()->OnOverviewModeStarting(); | 64 Shell::GetInstance()->OnOverviewModeStarting(); |
56 window_selector_.reset(new WindowSelector(this)); | 65 window_selector_.reset(new WindowSelector(this)); |
57 window_selector_->Init(windows); | 66 window_selector_->Init(windows); |
58 OnSelectionStarted(); | 67 OnSelectionStarted(); |
59 } | 68 } |
60 } | 69 } |
(...skipping 18 matching lines...) Expand all Loading... | |
79 | 88 |
80 void WindowSelectorController::OnSelectionStarted() { | 89 void WindowSelectorController::OnSelectionStarted() { |
81 if (!last_selection_time_.is_null()) { | 90 if (!last_selection_time_.is_null()) { |
82 UMA_HISTOGRAM_LONG_TIMES( | 91 UMA_HISTOGRAM_LONG_TIMES( |
83 "Ash.WindowSelector.TimeBetweenUse", | 92 "Ash.WindowSelector.TimeBetweenUse", |
84 base::Time::Now() - last_selection_time_); | 93 base::Time::Now() - last_selection_time_); |
85 } | 94 } |
86 } | 95 } |
87 | 96 |
88 } // namespace ash | 97 } // namespace ash |
OLD | NEW |