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

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

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 #ifndef CONTENT_BROWSER_MEDIA_SESSION_MEDIA_SESSION_UMA_HELPER_H_ 5 #ifndef CONTENT_BROWSER_MEDIA_SESSION_MEDIA_SESSION_UMA_HELPER_H_
6 #define CONTENT_BROWSER_MEDIA_SESSION_MEDIA_SESSION_UMA_HELPER_H_ 6 #define CONTENT_BROWSER_MEDIA_SESSION_MEDIA_SESSION_UMA_HELPER_H_
7 7
8 #include <memory> 8 #include <memory>
9 9
10 #include "base/time/clock.h" 10 #include "base/time/clock.h"
(...skipping 11 matching lines...) Expand all
22 // be appended only and must be added before |Count|. 22 // be appended only and must be added before |Count|.
23 enum class MediaSessionSuspendedSource { 23 enum class MediaSessionSuspendedSource {
24 SystemTransient = 0, 24 SystemTransient = 0,
25 SystemPermanent = 1, 25 SystemPermanent = 1,
26 UI = 2, 26 UI = 2,
27 CONTENT = 3, 27 CONTENT = 3,
28 SystemTransientDuck = 4, 28 SystemTransientDuck = 4,
29 Count // Leave at the end. 29 Count // Leave at the end.
30 }; 30 };
31 31
32 // Extended enum to blink::mojom::MediaSessionAction, distinguishing default
33 // action handling.
34 enum class MediaSessionUserAction {
35 Play = 0,
36 PlayDefault = 1,
37 Pause = 2,
38 PauseDefault = 3,
39 StopDefault = 4,
40 PreviousTrack = 5,
41 NextTrack = 6,
42 SeekBackward = 7,
43 SeekForward = 8,
44 Count // Leave at the end.
45 };
46
32 MediaSessionUmaHelper(); 47 MediaSessionUmaHelper();
33 ~MediaSessionUmaHelper(); 48 ~MediaSessionUmaHelper();
34 49
35 void RecordSessionSuspended(MediaSessionSuspendedSource source) const; 50 void RecordSessionSuspended(MediaSessionSuspendedSource source) const;
36 51
37 // Record the result of calling the native requestAudioFocus(). 52 // Record the result of calling the native requestAudioFocus().
38 void RecordRequestAudioFocusResult(bool result) const; 53 void RecordRequestAudioFocusResult(bool result) const;
39 54
55 void RecordMediaSessionUserAction(MediaSessionUserAction action) const;
mlamouri (slow - plz ping) 2017/04/07 11:15:56 Could that be static?
Zhiqiang Zhang (Slow) 2017/04/07 15:12:43 Done.
56
40 void OnSessionActive(); 57 void OnSessionActive();
41 void OnSessionSuspended(); 58 void OnSessionSuspended();
42 void OnSessionInactive(); 59 void OnSessionInactive();
43 60
44 void SetClockForTest(std::unique_ptr<base::TickClock> testing_clock); 61 void SetClockForTest(std::unique_ptr<base::TickClock> testing_clock);
45 62
46 private: 63 private:
47 base::TimeDelta total_active_time_; 64 base::TimeDelta total_active_time_;
48 base::TimeTicks current_active_time_; 65 base::TimeTicks current_active_time_;
49 std::unique_ptr<base::TickClock> clock_; 66 std::unique_ptr<base::TickClock> clock_;
50 }; 67 };
51 68
52 } // namespace content 69 } // namespace content
53 70
54 #endif // CONTENT_BROWSER_MEDIA_SESSION_MEDIA_SESSION_UMA_HELPER_H_ 71 #endif // CONTENT_BROWSER_MEDIA_SESSION_MEDIA_SESSION_UMA_HELPER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698