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

Side by Side Diff: ash/wm/maximize_mode/maximize_mode_controller.cc

Issue 914673003: Correctly record TouchView metrics on suspend/shutdown (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 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 | « no previous file | no next file » | 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/maximize_mode/maximize_mode_controller.h" 5 #include "ash/wm/maximize_mode/maximize_mode_controller.h"
6 6
7 #include "ash/accelerators/accelerator_controller.h" 7 #include "ash/accelerators/accelerator_controller.h"
8 #include "ash/accelerators/accelerator_table.h" 8 #include "ash/accelerators/accelerator_table.h"
9 #include "ash/ash_switches.h" 9 #include "ash/ash_switches.h"
10 #include "ash/display/display_manager.h" 10 #include "ash/display/display_manager.h"
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 174
175 void MaximizeModeController::LidEventReceived(bool open, 175 void MaximizeModeController::LidEventReceived(bool open,
176 const base::TimeTicks& time) { 176 const base::TimeTicks& time) {
177 if (open) 177 if (open)
178 last_lid_open_time_ = time; 178 last_lid_open_time_ = time;
179 lid_is_closed_ = !open; 179 lid_is_closed_ = !open;
180 LeaveMaximizeMode(); 180 LeaveMaximizeMode();
181 } 181 }
182 182
183 void MaximizeModeController::SuspendImminent() { 183 void MaximizeModeController::SuspendImminent() {
184 RecordTouchViewStateTransition(); 184 // Only record TouchView state transition metrics if the suspend occurred
185 // while in TouchView mode.
186 if (IsMaximizeModeWindowManagerEnabled())
187 RecordTouchViewStateTransition();
185 } 188 }
186 189
187 void MaximizeModeController::SuspendDone( 190 void MaximizeModeController::SuspendDone(
188 const base::TimeDelta& sleep_duration) { 191 const base::TimeDelta& sleep_duration) {
189 last_touchview_transition_time_ = base::Time::Now(); 192 last_touchview_transition_time_ = base::Time::Now();
190 } 193 }
191 194
192 void MaximizeModeController::HandleHingeRotation( 195 void MaximizeModeController::HandleHingeRotation(
193 const chromeos::AccelerometerUpdate& update) { 196 const chromeos::AccelerometerUpdate& update) {
194 static const gfx::Vector3dF hinge_vector(1.0f, 0.0f, 0.0f); 197 static const gfx::Vector3dF hinge_vector(1.0f, 0.0f, 0.0f);
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
283 } else { 286 } else {
284 UMA_HISTOGRAM_LONG_TIMES("Ash.TouchView.TouchViewActive", delta); 287 UMA_HISTOGRAM_LONG_TIMES("Ash.TouchView.TouchViewActive", delta);
285 total_touchview_time_ += delta; 288 total_touchview_time_ += delta;
286 } 289 }
287 last_touchview_transition_time_ = current_time; 290 last_touchview_transition_time_ = current_time;
288 } 291 }
289 } 292 }
290 293
291 void MaximizeModeController::OnAppTerminating() { 294 void MaximizeModeController::OnAppTerminating() {
292 if (CanEnterMaximizeMode()) { 295 if (CanEnterMaximizeMode()) {
293 RecordTouchViewStateTransition(); 296 RecordTouchViewStateTransition();
jonross 2015/02/10 19:38:07 It appears that the same situation can occur on de
tdanderson 2015/02/10 21:09:54 Ah, good catch. Done.
294 UMA_HISTOGRAM_CUSTOM_COUNTS("Ash.TouchView.TouchViewActiveTotal", 297 UMA_HISTOGRAM_CUSTOM_COUNTS("Ash.TouchView.TouchViewActiveTotal",
295 total_touchview_time_.InMinutes(), 298 total_touchview_time_.InMinutes(),
296 1, base::TimeDelta::FromDays(7).InMinutes(), 50); 299 1, base::TimeDelta::FromDays(7).InMinutes(), 50);
297 UMA_HISTOGRAM_CUSTOM_COUNTS("Ash.TouchView.TouchViewInactiveTotal", 300 UMA_HISTOGRAM_CUSTOM_COUNTS("Ash.TouchView.TouchViewInactiveTotal",
298 total_non_touchview_time_.InMinutes(), 301 total_non_touchview_time_.InMinutes(),
299 1, base::TimeDelta::FromDays(7).InMinutes(), 50); 302 1, base::TimeDelta::FromDays(7).InMinutes(), 50);
300 base::TimeDelta total_runtime = total_touchview_time_ + 303 base::TimeDelta total_runtime = total_touchview_time_ +
301 total_non_touchview_time_; 304 total_non_touchview_time_;
302 if (total_runtime.InSeconds() > 0) { 305 if (total_runtime.InSeconds() > 0) {
303 UMA_HISTOGRAM_PERCENTAGE("Ash.TouchView.TouchViewActivePercentage", 306 UMA_HISTOGRAM_PERCENTAGE("Ash.TouchView.TouchViewActivePercentage",
(...skipping 12 matching lines...) Expand all
316 return elapsed_time <= kLidRecentlyOpenedDuration; 319 return elapsed_time <= kLidRecentlyOpenedDuration;
317 } 320 }
318 321
319 void MaximizeModeController::SetTickClockForTest( 322 void MaximizeModeController::SetTickClockForTest(
320 scoped_ptr<base::TickClock> tick_clock) { 323 scoped_ptr<base::TickClock> tick_clock) {
321 DCHECK(tick_clock_); 324 DCHECK(tick_clock_);
322 tick_clock_ = tick_clock.Pass(); 325 tick_clock_ = tick_clock.Pass();
323 } 326 }
324 327
325 } // namespace ash 328 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698