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/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 Loading... | |
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(); | |
flackr
2015/02/10 21:32:11
This looks like it will report touch view inactive
tdanderson
2015/02/12 19:51:00
Done.
| |
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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
271 // their original position. | 274 // their original position. |
272 void MaximizeModeController::OnMaximizeModeEnded() { | 275 void MaximizeModeController::OnMaximizeModeEnded() { |
273 RecordTouchViewStateTransition(); | 276 RecordTouchViewStateTransition(); |
274 } | 277 } |
275 | 278 |
276 void MaximizeModeController::RecordTouchViewStateTransition() { | 279 void MaximizeModeController::RecordTouchViewStateTransition() { |
277 if (CanEnterMaximizeMode()) { | 280 if (CanEnterMaximizeMode()) { |
278 base::Time current_time = base::Time::Now(); | 281 base::Time current_time = base::Time::Now(); |
279 base::TimeDelta delta = current_time - last_touchview_transition_time_; | 282 base::TimeDelta delta = current_time - last_touchview_transition_time_; |
280 if (IsMaximizeModeWindowManagerEnabled()) { | 283 if (IsMaximizeModeWindowManagerEnabled()) { |
281 UMA_HISTOGRAM_LONG_TIMES("Ash.TouchView.TouchViewInactive", delta); | 284 UMA_HISTOGRAM_LONG_TIMES("Ash.TouchView.TouchViewInactive", delta); |
flackr
2015/02/10 21:32:11
Note: if suspending in maximize mode will report a
tdanderson
2015/02/12 19:51:00
Done.
| |
282 total_non_touchview_time_ += delta; | 285 total_non_touchview_time_ += delta; |
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 // Only record TouchView state transition metrics if shutdown occurred |
297 // while in TouchView mode. | |
298 if (IsMaximizeModeWindowManagerEnabled()) | |
299 RecordTouchViewStateTransition(); | |
300 | |
294 UMA_HISTOGRAM_CUSTOM_COUNTS("Ash.TouchView.TouchViewActiveTotal", | 301 UMA_HISTOGRAM_CUSTOM_COUNTS("Ash.TouchView.TouchViewActiveTotal", |
295 total_touchview_time_.InMinutes(), | 302 total_touchview_time_.InMinutes(), |
296 1, base::TimeDelta::FromDays(7).InMinutes(), 50); | 303 1, base::TimeDelta::FromDays(7).InMinutes(), 50); |
297 UMA_HISTOGRAM_CUSTOM_COUNTS("Ash.TouchView.TouchViewInactiveTotal", | 304 UMA_HISTOGRAM_CUSTOM_COUNTS("Ash.TouchView.TouchViewInactiveTotal", |
298 total_non_touchview_time_.InMinutes(), | 305 total_non_touchview_time_.InMinutes(), |
299 1, base::TimeDelta::FromDays(7).InMinutes(), 50); | 306 1, base::TimeDelta::FromDays(7).InMinutes(), 50); |
300 base::TimeDelta total_runtime = total_touchview_time_ + | 307 base::TimeDelta total_runtime = total_touchview_time_ + |
301 total_non_touchview_time_; | 308 total_non_touchview_time_; |
302 if (total_runtime.InSeconds() > 0) { | 309 if (total_runtime.InSeconds() > 0) { |
303 UMA_HISTOGRAM_PERCENTAGE("Ash.TouchView.TouchViewActivePercentage", | 310 UMA_HISTOGRAM_PERCENTAGE("Ash.TouchView.TouchViewActivePercentage", |
(...skipping 12 matching lines...) Expand all Loading... | |
316 return elapsed_time <= kLidRecentlyOpenedDuration; | 323 return elapsed_time <= kLidRecentlyOpenedDuration; |
317 } | 324 } |
318 | 325 |
319 void MaximizeModeController::SetTickClockForTest( | 326 void MaximizeModeController::SetTickClockForTest( |
320 scoped_ptr<base::TickClock> tick_clock) { | 327 scoped_ptr<base::TickClock> tick_clock) { |
321 DCHECK(tick_clock_); | 328 DCHECK(tick_clock_); |
322 tick_clock_ = tick_clock.Pass(); | 329 tick_clock_ = tick_clock.Pass(); |
323 } | 330 } |
324 | 331 |
325 } // namespace ash | 332 } // namespace ash |
OLD | NEW |