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

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

Issue 2108403003: Measure whether muted videos that started playing with play() become visible at some point (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: addressed mlamouri's comments Created 4 years, 5 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
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef AutoplayUmaHelper_h
6 #define AutoplayUmaHelper_h
7
8 #include "platform/heap/Handle.h"
9
10 namespace blink {
11
12 // These values are used for histograms. Do not reorder.
13 enum class AutoplaySource {
14 // Autoplay comes from HTMLMediaElement `autoplay` attribute.
15 Attribute = 0,
16 // Autoplay comes from `play()` method.
17 Method = 1,
18 // This enum value must be last.
19 NumberOfSources = 2,
20 };
21
22 // These values are used for histograms. Do not reorder.
23 enum AutoplayUnmuteActionStatus {
mlamouri (slow - plz ping) 2016/07/04 15:18:19 nit: `enum class`
Zhiqiang Zhang (Slow) 2016/07/06 13:55:51 Done.
24 Failure = 0,
25 Success = 1,
26 NumberOfStatus = 2,
27 };
28
29 class ElementVisibilityObserver;
30 class HTMLMediaElement;
31
32 class AutoplayUmaHelper final : public GarbageCollectedFinalized<AutoplayUmaHelp er> {
33
mlamouri (slow - plz ping) 2016/07/04 15:18:19 style: remove empty line
Zhiqiang Zhang (Slow) 2016/07/06 13:55:51 Done.
34 public:
35
mlamouri (slow - plz ping) 2016/07/04 15:18:19 style: ditto
Zhiqiang Zhang (Slow) 2016/07/06 13:55:51 Done.
36 static AutoplayUmaHelper* create(HTMLMediaElement* element)
37 {
38 return new AutoplayUmaHelper(element);
39 }
mlamouri (slow - plz ping) 2016/07/04 15:18:19 nit: can you move the definition to the cpp ?
Zhiqiang Zhang (Slow) 2016/07/06 13:55:51 Done.
40
41 ~AutoplayUmaHelper();
42
43 void onAutoplayInitiated(AutoplaySource);
44 void onAutoplayStarted();
45 void onElementDestroyed();
46
47 void recordAutoplayUnmuteStatus(AutoplayUnmuteActionStatus);
48
49 void onVisibilityChangedForVideoMutedPlayMethod(bool isVisible);
50
51 DECLARE_TRACE();
52
53 private:
54 explicit AutoplayUmaHelper(HTMLMediaElement*);
55
56 // The autoplay source. Use AutoplaySource::NumberOfSources for invalid sour ce.
57 AutoplaySource m_source;
58 WeakMember<HTMLMediaElement> m_element;
59 Member<ElementVisibilityObserver> m_videoMutedPlayMethodVisibilityObserver;
60 };
61
62 } // namespace blink
63
64 #endif // AutoplayUmaHelper_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698