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(); | |
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 Loading... | |
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 Loading... | |
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 |
OLD | NEW |