OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 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 AutoplayUmaHelper_h | 5 #ifndef AutoplayUmaHelper_h |
6 #define AutoplayUmaHelper_h | 6 #define AutoplayUmaHelper_h |
7 | 7 |
8 #include "core/events/EventListener.h" | 8 #include "core/events/EventListener.h" |
9 #include "platform/heap/Handle.h" | 9 #include "platform/heap/Handle.h" |
10 | 10 |
11 namespace blink { | 11 namespace blink { |
12 | 12 |
13 // These values are used for histograms. Do not reorder. | 13 // These values are used for histograms. Do not reorder. |
14 enum class AutoplaySource { | 14 enum class AutoplaySource { |
15 // Autoplay comes from HTMLMediaElement `autoplay` attribute. | 15 // Autoplay comes from HTMLMediaElement `autoplay` attribute. |
16 Attribute = 0, | 16 Attribute = 0, |
17 // Autoplay comes from `play()` method. | 17 // Autoplay comes from `play()` method. |
18 Method = 1, | 18 Method = 1, |
19 // This enum value must be last. | 19 // This enum value must be last. |
20 NumberOfSources = 2, | 20 NumberOfSources = 2, |
21 }; | 21 }; |
22 | 22 |
23 // These values are used for histograms. Do not reorder. | 23 // These values are used for histograms. Do not reorder. |
24 enum class AutoplayUnmuteActionStatus { | 24 enum class AutoplayUnmuteActionStatus { |
25 Failure = 0, | 25 Failure = 0, |
26 Success = 1, | 26 Success = 1, |
27 NumberOfStatus = 2, | 27 NumberOfStatus = 2, |
28 }; | 28 }; |
29 | 29 |
| 30 // These values are used for histograms. Do not reorder. |
| 31 enum AutoplayBlockedReason { |
| 32 AutoplayBlockedReasonDataSaver = 0, |
| 33 AutoplayBlockedReasonSetting = 1, |
| 34 AutoplayBlockedReasonDataSaverAndSetting = 2, |
| 35 // Keey at the end. |
| 36 AutoplayBlockedReasonMax = 3 |
| 37 }; |
| 38 |
30 class Document; | 39 class Document; |
31 class ElementVisibilityObserver; | 40 class ElementVisibilityObserver; |
32 class HTMLMediaElement; | 41 class HTMLMediaElement; |
33 | 42 |
34 class AutoplayUmaHelper final : public EventListener { | 43 class AutoplayUmaHelper final : public EventListener { |
35 public: | 44 public: |
36 static AutoplayUmaHelper* create(HTMLMediaElement*); | 45 static AutoplayUmaHelper* create(HTMLMediaElement*); |
37 | 46 |
38 ~AutoplayUmaHelper(); | 47 ~AutoplayUmaHelper(); |
39 | 48 |
(...skipping 21 matching lines...) Expand all Loading... |
61 AutoplaySource m_source; | 70 AutoplaySource m_source; |
62 // The media element this UMA helper is attached to. |m_element| owns |this|
. | 71 // The media element this UMA helper is attached to. |m_element| owns |this|
. |
63 WeakMember<HTMLMediaElement> m_element; | 72 WeakMember<HTMLMediaElement> m_element; |
64 // The observer is used to observe whether a muted video autoplaying by play
() method become visible at some point. | 73 // The observer is used to observe whether a muted video autoplaying by play
() method become visible at some point. |
65 Member<ElementVisibilityObserver> m_videoMutedPlayMethodVisibilityObserver; | 74 Member<ElementVisibilityObserver> m_videoMutedPlayMethodVisibilityObserver; |
66 }; | 75 }; |
67 | 76 |
68 } // namespace blink | 77 } // namespace blink |
69 | 78 |
70 #endif // AutoplayUmaHelper_h | 79 #endif // AutoplayUmaHelper_h |
OLD | NEW |