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