Chromium Code Reviews| Index: ash/wm/overview/window_selector_controller.cc |
| diff --git a/ash/wm/overview/window_selector_controller.cc b/ash/wm/overview/window_selector_controller.cc |
| index f9839dcb43a7669f5ad66334d5821abc65cf33ef..c9d9e2c72f4a8ac47c0cc0c9821e8620de774dc2 100644 |
| --- a/ash/wm/overview/window_selector_controller.cc |
| +++ b/ash/wm/overview/window_selector_controller.cc |
| @@ -6,9 +6,11 @@ |
| #include "ash/session_state_delegate.h" |
| #include "ash/shell.h" |
| +#include "ash/shell_delegate.h" |
| #include "ash/wm/mru_window_tracker.h" |
| #include "ash/wm/overview/window_selector.h" |
| #include "ash/wm/window_util.h" |
| +#include "base/metrics/histogram.h" |
| namespace ash { |
| @@ -36,9 +38,9 @@ void WindowSelectorController::ToggleOverview() { |
| if (windows.empty()) |
| return; |
| - // Removing focus will hide popup windows like the omnibar or open menus. |
| window_selector_.reset( |
| new WindowSelector(windows, WindowSelector::OVERVIEW, this)); |
| + OnSelectionStarted(); |
| } |
| } |
| @@ -54,9 +56,9 @@ void WindowSelectorController::HandleCycleWindow( |
| if (windows.empty()) |
| return; |
| - // Removing focus will hide popup windows like the omnibar or open menus. |
| window_selector_.reset( |
| new WindowSelector(windows, WindowSelector::CYCLE, this)); |
| + OnSelectionStarted(); |
| window_selector_->Step(direction); |
| } else if (window_selector_->mode() == WindowSelector::CYCLE) { |
| window_selector_->Step(direction); |
| @@ -70,10 +72,22 @@ bool WindowSelectorController::IsSelecting() { |
| void WindowSelectorController::OnWindowSelected(aura::Window* window) { |
| window_selector_.reset(); |
| wm::ActivateWindow(window); |
| + last_selection_time_ = base::Time::Now(); |
| } |
| void WindowSelectorController::OnSelectionCanceled() { |
| window_selector_.reset(); |
| + last_selection_time_ = base::Time::Now(); |
| +} |
| + |
| +void WindowSelectorController::OnSelectionStarted() { |
| + if (!last_selection_time_.is_null()) { |
| + Shell* shell = Shell::GetInstance(); |
| + shell->delegate()->RecordUserMetricsAction(UMA_WINDOW_SELECTION); |
|
Ilya Sherman
2013/09/19 23:08:04
Why is this gated on whether or not the last_selec
flackr
2013/09/19 23:23:45
Good catch, this should not be.
|
| + UMA_HISTOGRAM_LONG_TIMES( |
| + "Ash.WindowSelector.TimeBetweenUse", |
| + base::Time::Now() - last_selection_time_); |
|
Ilya Sherman
2013/09/19 23:08:04
Hmm, is LONG_TIMES really enough? I'd expect it t
flackr
2013/09/19 23:23:45
In terms of usage, I think the exact timing beyond
|
| + } |
| } |
| } // namespace ash |