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

Side by Side Diff: third_party/WebKit/Source/core/html/AutoplayExperimentHelper.h

Issue 1470153004: Autoplay experiment metric fixes and additions. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: added histograms.xml . Created 5 years 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 AutoplayExperimentHelper_h 5 #ifndef AutoplayExperimentHelper_h
6 #define AutoplayExperimentHelper_h 6 #define AutoplayExperimentHelper_h
7 7
8 #include "core/page/Page.h" 8 #include "core/page/Page.h"
9 #include "platform/Timer.h" 9 #include "platform/Timer.h"
10 #include "platform/geometry/IntRect.h" 10 #include "platform/geometry/IntRect.h"
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 55
56 // play() failed to play due to gesture requirement. 56 // play() failed to play due to gesture requirement.
57 PlayMethodFailed = 10, 57 PlayMethodFailed = 10,
58 58
59 // Some play, whether user initiated or not, started. 59 // Some play, whether user initiated or not, started.
60 AnyPlaybackStarted = 11, 60 AnyPlaybackStarted = 11,
61 // Some play, whether user initiated or not, paused. 61 // Some play, whether user initiated or not, paused.
62 AnyPlaybackPaused = 12, 62 AnyPlaybackPaused = 12,
63 // Some playback, whether user initiated or not, bailed out early. 63 // Some playback, whether user initiated or not, bailed out early.
64 AnyPlaybackBailout = 13, 64 AnyPlaybackBailout = 13,
65 // Some playback, whether user initiated or not, played to completion.
66 AnyPlaybackComplete = 14,
67
68 // Number of media elements detected.
69 AnyMediaElement = 15,
70 // Numer of video elements detected.
71 AnyVideoElement = 16,
72
73 // User gesture was bypassed,and playback started, and media played to
philipj_slow 2015/11/25 14:03:41 space before comma
liberato (no reviews please) 2015/11/25 18:58:54 Done.
74 // completion without a user-supplied pause.
philipj_slow 2015/11/25 14:03:41 user-initiated maybe?
liberato (no reviews please) 2015/11/25 18:58:54 Done.
75 AutoplayComplete = 17,
76
77 // The initial playback started with a user gesture being processed by the
78 // element at or before.
philipj_slow 2015/11/25 14:03:41 at or before... what? :)
liberato (no reviews please) 2015/11/25 18:58:54 Done.
79 InitialPlayWithUserGesture = 18,
80
81 // The initial playback started while a user gesture was being processed.
82 InitialPlayDuringUserGesture = 19,
83
84 // The initial playback started while no user gesture was being processed,
85 // though one might have been processed earlier to remove any gesture
86 // requirement (e.g., during load).
87 InitialPlayNotDuringUserGesture = 20,
88
89 // The initial playback started without any user gesture being processed
90 // by the element now or at any point prior to this.
91 InitialPlayWithoutUserGesture = 21,
65 92
66 // This enum value must be last. 93 // This enum value must be last.
67 NumberOfAutoplayMetrics, 94 NumberOfAutoplayMetrics,
68 }; 95 };
69 96
70 class AutoplayExperimentHelper final { 97 class AutoplayExperimentHelper final {
71 DISALLOW_NEW_EXCEPT_PLACEMENT_NEW(); 98 DISALLOW_NEW_EXCEPT_PLACEMENT_NEW();
72 public: 99 public:
73 explicit AutoplayExperimentHelper(HTMLMediaElement&); 100 explicit AutoplayExperimentHelper(HTMLMediaElement&);
74 ~AutoplayExperimentHelper(); 101 ~AutoplayExperimentHelper();
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 // requires it, else do nothing. 157 // requires it, else do nothing.
131 void muteIfNeeded(); 158 void muteIfNeeded();
132 159
133 // Maybe override the requirement for a user gesture, and start playing 160 // Maybe override the requirement for a user gesture, and start playing
134 // autoplay media. Returns true if only if it starts playback. 161 // autoplay media. Returns true if only if it starts playback.
135 bool maybeStartPlaying(); 162 bool maybeStartPlaying();
136 163
137 // Configure internal state to record that the autoplay experiment is 164 // Configure internal state to record that the autoplay experiment is
138 // going to start playback. This doesn't actually start playback, since 165 // going to start playback. This doesn't actually start playback, since
139 // there are several different cases. 166 // there are several different cases.
140 void prepareToPlay(AutoplayMetrics); 167 void prepareToAutoplay(AutoplayMetrics);
141 168
142 // Process a timer for checking visibility. 169 // Process a timer for checking visibility.
143 void viewportTimerFired(Timer<AutoplayExperimentHelper>*); 170 void viewportTimerFired(Timer<AutoplayExperimentHelper>*);
144 171
145 // Return our media element's document. 172 // Return our media element's document.
146 Document& document() const; 173 Document& document() const;
147 174
148 HTMLMediaElement& element() const; 175 HTMLMediaElement& element() const;
149 176
150 inline bool enabled(Mode mode) const 177 inline bool enabled(Mode mode) const
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 const AutoplayExperimentHelper::Mode& b) 209 const AutoplayExperimentHelper::Mode& b)
183 { 210 {
184 a = static_cast<AutoplayExperimentHelper::Mode>(static_cast<int>(a) | static _cast<int>(b)); 211 a = static_cast<AutoplayExperimentHelper::Mode>(static_cast<int>(a) | static _cast<int>(b));
185 return a; 212 return a;
186 } 213 }
187 214
188 215
189 } // namespace blink 216 } // namespace blink
190 217
191 #endif // AutoplayExperimentHelper_h 218 #endif // AutoplayExperimentHelper_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698