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

Side by Side Diff: content/browser/media/session/media_session_uma_helper.cc

Issue 2798083002: Record user interactions with MediaSession by action type (Closed)
Patch Set: Created 3 years, 8 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "content/browser/media/session/media_session_uma_helper.h" 5 #include "content/browser/media/session/media_session_uma_helper.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/metrics/histogram_base.h" 9 #include "base/metrics/histogram_base.h"
10 #include "base/metrics/histogram_macros.h" 10 #include "base/metrics/histogram_macros.h"
(...skipping 15 matching lines...) Expand all
26 UMA_HISTOGRAM_ENUMERATION( 26 UMA_HISTOGRAM_ENUMERATION(
27 "Media.Session.Suspended", 27 "Media.Session.Suspended",
28 static_cast<HistogramBase::Sample>(source), 28 static_cast<HistogramBase::Sample>(source),
29 static_cast<HistogramBase::Sample>(MediaSessionSuspendedSource::Count)); 29 static_cast<HistogramBase::Sample>(MediaSessionSuspendedSource::Count));
30 } 30 }
31 31
32 void MediaSessionUmaHelper::RecordRequestAudioFocusResult(bool result) const { 32 void MediaSessionUmaHelper::RecordRequestAudioFocusResult(bool result) const {
33 UMA_HISTOGRAM_BOOLEAN("Media.Session.RequestAudioFocusResult", result); 33 UMA_HISTOGRAM_BOOLEAN("Media.Session.RequestAudioFocusResult", result);
34 } 34 }
35 35
36 void MediaSessionUmaHelper::RecordMediaSessionUserAction(
37 MediaSessionUserAction action) const {
38 UMA_HISTOGRAM_ENUMERATION(
39 "Media.Session.UserAction", static_cast<HistogramBase::Sample>(action),
40 static_cast<HistogramBase::Sample>(MediaSessionUserAction::Count));
41 }
42
36 void MediaSessionUmaHelper::OnSessionActive() { 43 void MediaSessionUmaHelper::OnSessionActive() {
37 current_active_time_ = clock_->NowTicks(); 44 current_active_time_ = clock_->NowTicks();
38 } 45 }
39 46
40 void MediaSessionUmaHelper::OnSessionSuspended() { 47 void MediaSessionUmaHelper::OnSessionSuspended() {
41 if (current_active_time_.is_null()) 48 if (current_active_time_.is_null())
42 return; 49 return;
43 50
44 total_active_time_ += clock_->NowTicks() - current_active_time_; 51 total_active_time_ += clock_->NowTicks() - current_active_time_;
45 current_active_time_ = base::TimeTicks(); 52 current_active_time_ = base::TimeTicks();
(...skipping 11 matching lines...) Expand all
57 UMA_HISTOGRAM_LONG_TIMES("Media.Session.ActiveTime", total_active_time_); 64 UMA_HISTOGRAM_LONG_TIMES("Media.Session.ActiveTime", total_active_time_);
58 total_active_time_ = base::TimeDelta(); 65 total_active_time_ = base::TimeDelta();
59 } 66 }
60 67
61 void MediaSessionUmaHelper::SetClockForTest( 68 void MediaSessionUmaHelper::SetClockForTest(
62 std::unique_ptr<base::TickClock> testing_clock) { 69 std::unique_ptr<base::TickClock> testing_clock) {
63 clock_ = std::move(testing_clock); 70 clock_ = std::move(testing_clock);
64 } 71 }
65 72
66 } // namespace content 73 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698