Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(401)

Side by Side Diff: ash/wm/window_cycle_controller.cc

Issue 2115663002: Folds methods in WmShellCommon to WmShell (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: merge Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ash/wm/screen_pinning_controller.cc ('k') | ash/wm/window_cycle_list.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/wm/window_cycle_controller.h" 5 #include "ash/wm/window_cycle_controller.h"
6 6
7 #include "ash/common/session/session_state_delegate.h" 7 #include "ash/common/session/session_state_delegate.h"
8 #include "ash/common/wm/mru_window_tracker.h" 8 #include "ash/common/wm/mru_window_tracker.h"
9 #include "ash/common/wm_shell.h" 9 #include "ash/common/wm_shell.h"
10 #include "ash/shell.h" 10 #include "ash/shell.h"
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 return; 79 return;
80 80
81 if (!IsCycling()) 81 if (!IsCycling())
82 StartCycling(); 82 StartCycling();
83 83
84 Step(direction); 84 Step(direction);
85 } 85 }
86 86
87 void WindowCycleController::StartCycling() { 87 void WindowCycleController::StartCycling() {
88 MruWindowTracker::WindowList window_list = 88 MruWindowTracker::WindowList window_list =
89 Shell::GetInstance()->mru_window_tracker()->BuildMruWindowList(); 89 WmShell::Get()->mru_window_tracker()->BuildMruWindowList();
90 90
91 active_window_before_window_cycle_ = GetActiveWindow(window_list); 91 active_window_before_window_cycle_ = GetActiveWindow(window_list);
92 92
93 window_cycle_list_.reset(new WindowCycleList(window_list)); 93 window_cycle_list_.reset(new WindowCycleList(window_list));
94 event_handler_.reset(new WindowCycleEventFilter()); 94 event_handler_.reset(new WindowCycleEventFilter());
95 cycle_start_time_ = base::Time::Now(); 95 cycle_start_time_ = base::Time::Now();
96 WmShell::Get()->RecordUserMetricsAction(UMA_WINDOW_CYCLE); 96 WmShell::Get()->RecordUserMetricsAction(UMA_WINDOW_CYCLE);
97 UMA_HISTOGRAM_COUNTS_100("Ash.WindowCycleController.Items", 97 UMA_HISTOGRAM_COUNTS_100("Ash.WindowCycleController.Items",
98 window_list.size()); 98 window_list.size());
99 } 99 }
100 100
101 ////////////////////////////////////////////////////////////////////////////// 101 //////////////////////////////////////////////////////////////////////////////
102 // WindowCycleController, private: 102 // WindowCycleController, private:
103 103
104 void WindowCycleController::Step(Direction direction) { 104 void WindowCycleController::Step(Direction direction) {
105 DCHECK(window_cycle_list_.get()); 105 DCHECK(window_cycle_list_.get());
106 window_cycle_list_->Step(direction); 106 window_cycle_list_->Step(direction);
107 } 107 }
108 108
109 void WindowCycleController::StopCycling() { 109 void WindowCycleController::StopCycling() {
110 UMA_HISTOGRAM_COUNTS_100("Ash.WindowCycleController.SelectionDepth", 110 UMA_HISTOGRAM_COUNTS_100("Ash.WindowCycleController.SelectionDepth",
111 window_cycle_list_->current_index() + 1); 111 window_cycle_list_->current_index() + 1);
112 window_cycle_list_.reset(); 112 window_cycle_list_.reset();
113 113
114 WmWindow* active_window_after_window_cycle = GetActiveWindow( 114 WmWindow* active_window_after_window_cycle = GetActiveWindow(
115 Shell::GetInstance()->mru_window_tracker()->BuildMruWindowList()); 115 WmShell::Get()->mru_window_tracker()->BuildMruWindowList());
116 116
117 // Remove our key event filter. 117 // Remove our key event filter.
118 event_handler_.reset(); 118 event_handler_.reset();
119 UMA_HISTOGRAM_MEDIUM_TIMES("Ash.WindowCycleController.CycleTime", 119 UMA_HISTOGRAM_MEDIUM_TIMES("Ash.WindowCycleController.CycleTime",
120 base::Time::Now() - cycle_start_time_); 120 base::Time::Now() - cycle_start_time_);
121 121
122 if (active_window_after_window_cycle != nullptr && 122 if (active_window_after_window_cycle != nullptr &&
123 active_window_before_window_cycle_ != active_window_after_window_cycle) { 123 active_window_before_window_cycle_ != active_window_after_window_cycle) {
124 Shell::GetInstance() 124 Shell::GetInstance()
125 ->metrics() 125 ->metrics()
126 ->task_switch_metrics_recorder() 126 ->task_switch_metrics_recorder()
127 .OnTaskSwitch(TaskSwitchMetricsRecorder::WINDOW_CYCLE_CONTROLLER); 127 .OnTaskSwitch(TaskSwitchMetricsRecorder::WINDOW_CYCLE_CONTROLLER);
128 } 128 }
129 active_window_before_window_cycle_ = nullptr; 129 active_window_before_window_cycle_ = nullptr;
130 } 130 }
131 131
132 } // namespace ash 132 } // namespace ash
OLDNEW
« no previous file with comments | « ash/wm/screen_pinning_controller.cc ('k') | ash/wm/window_cycle_list.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698