| 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/common/session/session_state_delegate.h" | 9 #include "ash/common/session/session_state_delegate.h" |
| 10 #include "ash/common/wm/mru_window_tracker.h" |
| 10 #include "ash/common/wm/window_state.h" | 11 #include "ash/common/wm/window_state.h" |
| 11 #include "ash/common/wm_shell.h" | 12 #include "ash/common/wm_shell.h" |
| 12 #include "ash/common/wm_window.h" | 13 #include "ash/common/wm_window.h" |
| 13 #include "ash/shell.h" | 14 #include "ash/shell.h" |
| 14 #include "ash/system/tray/system_tray_delegate.h" | 15 #include "ash/system/tray/system_tray_delegate.h" |
| 15 #include "ash/wm/overview/window_selector.h" | 16 #include "ash/wm/overview/window_selector.h" |
| 16 #include "base/metrics/histogram.h" | 17 #include "base/metrics/histogram.h" |
| 17 | 18 |
| 18 namespace ash { | 19 namespace ash { |
| 19 | 20 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 36 } | 37 } |
| 37 | 38 |
| 38 void WindowSelectorController::ToggleOverview() { | 39 void WindowSelectorController::ToggleOverview() { |
| 39 if (IsSelecting()) { | 40 if (IsSelecting()) { |
| 40 OnSelectionEnded(); | 41 OnSelectionEnded(); |
| 41 } else { | 42 } else { |
| 42 // Don't start overview if window selection is not allowed. | 43 // Don't start overview if window selection is not allowed. |
| 43 if (!CanSelect()) | 44 if (!CanSelect()) |
| 44 return; | 45 return; |
| 45 | 46 |
| 46 std::vector<WmWindow*> windows = WmShell::Get()->GetMruWindowList(); | 47 std::vector<WmWindow*> windows = |
| 48 WmShell::Get()->mru_window_tracker()->BuildMruWindowList(); |
| 47 auto end = | 49 auto end = |
| 48 std::remove_if(windows.begin(), windows.end(), | 50 std::remove_if(windows.begin(), windows.end(), |
| 49 std::not1(std::ptr_fun(&WindowSelector::IsSelectable))); | 51 std::not1(std::ptr_fun(&WindowSelector::IsSelectable))); |
| 50 windows.resize(end - windows.begin()); | 52 windows.resize(end - windows.begin()); |
| 51 | 53 |
| 52 // Don't enter overview mode with no windows. | 54 // Don't enter overview mode with no windows. |
| 53 if (windows.empty()) | 55 if (windows.empty()) |
| 54 return; | 56 return; |
| 55 | 57 |
| 56 Shell::GetInstance()->OnOverviewModeStarting(); | 58 Shell::GetInstance()->OnOverviewModeStarting(); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 80 | 82 |
| 81 void WindowSelectorController::OnSelectionStarted() { | 83 void WindowSelectorController::OnSelectionStarted() { |
| 82 if (!last_selection_time_.is_null()) { | 84 if (!last_selection_time_.is_null()) { |
| 83 UMA_HISTOGRAM_LONG_TIMES( | 85 UMA_HISTOGRAM_LONG_TIMES( |
| 84 "Ash.WindowSelector.TimeBetweenUse", | 86 "Ash.WindowSelector.TimeBetweenUse", |
| 85 base::Time::Now() - last_selection_time_); | 87 base::Time::Now() - last_selection_time_); |
| 86 } | 88 } |
| 87 } | 89 } |
| 88 | 90 |
| 89 } // namespace ash | 91 } // namespace ash |
| OLD | NEW |