| 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/session/session_controller.h" | 9 #include "ash/session/session_controller.h" |
| 10 #include "ash/shell.h" | 10 #include "ash/shell.h" |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 } | 42 } |
| 43 | 43 |
| 44 bool WindowSelectorController::ToggleOverview() { | 44 bool WindowSelectorController::ToggleOverview() { |
| 45 if (IsSelecting()) { | 45 if (IsSelecting()) { |
| 46 OnSelectionEnded(); | 46 OnSelectionEnded(); |
| 47 } else { | 47 } else { |
| 48 // Don't start overview if window selection is not allowed. | 48 // Don't start overview if window selection is not allowed. |
| 49 if (!CanSelect()) | 49 if (!CanSelect()) |
| 50 return false; | 50 return false; |
| 51 | 51 |
| 52 std::vector<WmWindow*> windows = | 52 auto windows = Shell::Get()->mru_window_tracker()->BuildMruWindowList(); |
| 53 Shell::Get()->mru_window_tracker()->BuildMruWindowList(); | |
| 54 auto end = | 53 auto end = |
| 55 std::remove_if(windows.begin(), windows.end(), | 54 std::remove_if(windows.begin(), windows.end(), |
| 56 std::not1(std::ptr_fun(&WindowSelector::IsSelectable))); | 55 std::not1(std::ptr_fun(&WindowSelector::IsSelectable))); |
| 57 windows.resize(end - windows.begin()); | 56 windows.resize(end - windows.begin()); |
| 58 | 57 |
| 59 // Don't enter overview mode with no windows. | 58 // Don't enter overview mode with no windows. |
| 60 if (windows.empty()) | 59 if (windows.empty()) |
| 61 return false; | 60 return false; |
| 62 | 61 |
| 63 Shell::Get()->NotifyOverviewModeStarting(); | 62 Shell::Get()->NotifyOverviewModeStarting(); |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 } | 121 } |
| 123 | 122 |
| 124 void WindowSelectorController::OnSelectionStarted() { | 123 void WindowSelectorController::OnSelectionStarted() { |
| 125 if (!last_selection_time_.is_null()) { | 124 if (!last_selection_time_.is_null()) { |
| 126 UMA_HISTOGRAM_LONG_TIMES("Ash.WindowSelector.TimeBetweenUse", | 125 UMA_HISTOGRAM_LONG_TIMES("Ash.WindowSelector.TimeBetweenUse", |
| 127 base::Time::Now() - last_selection_time_); | 126 base::Time::Now() - last_selection_time_); |
| 128 } | 127 } |
| 129 } | 128 } |
| 130 | 129 |
| 131 } // namespace ash | 130 } // namespace ash |
| OLD | NEW |