| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/common/wm/window_cycle_controller.h" | 5 #include "ash/common/wm/window_cycle_controller.h" |
| 6 | 6 |
| 7 #include "ash/common/metrics/task_switch_source.h" | 7 #include "ash/common/metrics/task_switch_source.h" |
| 8 #include "ash/common/session/session_state_delegate.h" | 8 #include "ash/common/session/session_state_delegate.h" |
| 9 #include "ash/common/wm/mru_window_tracker.h" | 9 #include "ash/common/wm/mru_window_tracker.h" |
| 10 #include "ash/common/wm/window_cycle_event_filter.h" | 10 #include "ash/common/wm/window_cycle_event_filter.h" |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 active_window_before_window_cycle_ = GetActiveWindow(window_list); | 71 active_window_before_window_cycle_ = GetActiveWindow(window_list); |
| 72 | 72 |
| 73 window_cycle_list_.reset(new WindowCycleList(window_list)); | 73 window_cycle_list_.reset(new WindowCycleList(window_list)); |
| 74 event_filter_ = WmShell::Get()->CreateWindowCycleEventFilter(); | 74 event_filter_ = WmShell::Get()->CreateWindowCycleEventFilter(); |
| 75 cycle_start_time_ = base::Time::Now(); | 75 cycle_start_time_ = base::Time::Now(); |
| 76 WmShell::Get()->RecordUserMetricsAction(UMA_WINDOW_CYCLE); | 76 WmShell::Get()->RecordUserMetricsAction(UMA_WINDOW_CYCLE); |
| 77 UMA_HISTOGRAM_COUNTS_100("Ash.WindowCycleController.Items", | 77 UMA_HISTOGRAM_COUNTS_100("Ash.WindowCycleController.Items", |
| 78 window_list.size()); | 78 window_list.size()); |
| 79 } | 79 } |
| 80 | 80 |
| 81 void WindowCycleController::CompleteCycling() { |
| 82 window_cycle_list_->set_user_did_accept(true); |
| 83 StopCycling(); |
| 84 } |
| 85 |
| 86 void WindowCycleController::CancelCycling() { |
| 87 StopCycling(); |
| 88 } |
| 89 |
| 81 ////////////////////////////////////////////////////////////////////////////// | 90 ////////////////////////////////////////////////////////////////////////////// |
| 82 // WindowCycleController, private: | 91 // WindowCycleController, private: |
| 83 | 92 |
| 84 void WindowCycleController::Step(Direction direction) { | 93 void WindowCycleController::Step(Direction direction) { |
| 85 DCHECK(window_cycle_list_.get()); | 94 DCHECK(window_cycle_list_.get()); |
| 86 window_cycle_list_->Step(direction); | 95 window_cycle_list_->Step(direction); |
| 87 } | 96 } |
| 88 | 97 |
| 89 void WindowCycleController::StopCycling() { | 98 void WindowCycleController::StopCycling() { |
| 90 UMA_HISTOGRAM_COUNTS_100("Ash.WindowCycleController.SelectionDepth", | 99 UMA_HISTOGRAM_COUNTS_100("Ash.WindowCycleController.SelectionDepth", |
| (...skipping 10 matching lines...) Expand all Loading... |
| 101 | 110 |
| 102 if (active_window_after_window_cycle != nullptr && | 111 if (active_window_after_window_cycle != nullptr && |
| 103 active_window_before_window_cycle_ != active_window_after_window_cycle) { | 112 active_window_before_window_cycle_ != active_window_after_window_cycle) { |
| 104 WmShell::Get()->RecordTaskSwitchMetric( | 113 WmShell::Get()->RecordTaskSwitchMetric( |
| 105 TaskSwitchSource::WINDOW_CYCLE_CONTROLLER); | 114 TaskSwitchSource::WINDOW_CYCLE_CONTROLLER); |
| 106 } | 115 } |
| 107 active_window_before_window_cycle_ = nullptr; | 116 active_window_before_window_cycle_ = nullptr; |
| 108 } | 117 } |
| 109 | 118 |
| 110 } // namespace ash | 119 } // namespace ash |
| OLD | NEW |