| 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/CoreExport.h" | 8 #include "core/CoreExport.h" |
| 9 #include "core/dom/ContextLifecycleObserver.h" | 9 #include "core/dom/ContextLifecycleObserver.h" |
| 10 #include "core/events/EventListener.h" | 10 #include "core/events/EventListener.h" |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 // These values are used for histograms. Do not reorder. | 34 // These values are used for histograms. Do not reorder. |
| 35 enum AutoplayBlockedReason { | 35 enum AutoplayBlockedReason { |
| 36 AutoplayBlockedReasonDataSaver = 0, | 36 AutoplayBlockedReasonDataSaver = 0, |
| 37 AutoplayBlockedReasonSetting = 1, | 37 AutoplayBlockedReasonSetting = 1, |
| 38 AutoplayBlockedReasonDataSaverAndSetting = 2, | 38 AutoplayBlockedReasonDataSaverAndSetting = 2, |
| 39 // Keey at the end. | 39 // Keey at the end. |
| 40 AutoplayBlockedReasonMax = 3 | 40 AutoplayBlockedReasonMax = 3 |
| 41 }; | 41 }; |
| 42 | 42 |
| 43 enum class CrossOriginAutoplayResult { | 43 enum class CrossOriginAutoplayResult { |
| 44 AutoplayAllowed, | 44 AutoplayAllowed = 0, |
| 45 AutoplayBlocked, | 45 AutoplayBlocked = 1, |
| 46 PlayedWithGesture, | 46 PlayedWithGesture = 2, |
| 47 UserPaused = 3, |
| 48 // Keep at the end. |
| 49 NumberOfResults = 4, |
| 47 }; | 50 }; |
| 48 | 51 |
| 49 class Document; | 52 class Document; |
| 50 class ElementVisibilityObserver; | 53 class ElementVisibilityObserver; |
| 51 class HTMLMediaElement; | 54 class HTMLMediaElement; |
| 52 | 55 |
| 53 class CORE_EXPORT AutoplayUmaHelper : public EventListener, | 56 class CORE_EXPORT AutoplayUmaHelper : public EventListener, |
| 54 public ContextLifecycleObserver { | 57 public ContextLifecycleObserver { |
| 55 USING_GARBAGE_COLLECTED_MIXIN(AutoplayUmaHelper); | 58 USING_GARBAGE_COLLECTED_MIXIN(AutoplayUmaHelper); |
| 56 | 59 |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 int64_t m_mutedVideoAutoplayOffscreenStartTimeMS; | 126 int64_t m_mutedVideoAutoplayOffscreenStartTimeMS; |
| 124 | 127 |
| 125 // The duration an autoplaying muted video has been in offscreen. | 128 // The duration an autoplaying muted video has been in offscreen. |
| 126 int64_t m_mutedVideoAutoplayOffscreenDurationMS; | 129 int64_t m_mutedVideoAutoplayOffscreenDurationMS; |
| 127 | 130 |
| 128 // Whether an autoplaying muted video is visible. | 131 // Whether an autoplaying muted video is visible. |
| 129 bool m_isVisible; | 132 bool m_isVisible; |
| 130 | 133 |
| 131 std::set<CrossOriginAutoplayResult> m_recordedCrossOriginAutoplayResults; | 134 std::set<CrossOriginAutoplayResult> m_recordedCrossOriginAutoplayResults; |
| 132 | 135 |
| 133 // Whether the UMA helper has recorded user pausing a cross-origin video. | |
| 134 bool m_hasRecordedUserPausedAutoplayingCrossOriginVideo; | |
| 135 | |
| 136 // The observer is used to observer an autoplaying muted video changing it's | 136 // The observer is used to observer an autoplaying muted video changing it's |
| 137 // visibility, which is used for offscreen duration UMA. The UMA is pending | 137 // visibility, which is used for offscreen duration UMA. The UMA is pending |
| 138 // for recording as long as this observer is non-null. | 138 // for recording as long as this observer is non-null. |
| 139 Member<ElementVisibilityObserver> | 139 Member<ElementVisibilityObserver> |
| 140 m_mutedVideoOffscreenDurationVisibilityObserver; | 140 m_mutedVideoOffscreenDurationVisibilityObserver; |
| 141 }; | 141 }; |
| 142 | 142 |
| 143 } // namespace blink | 143 } // namespace blink |
| 144 | 144 |
| 145 #endif // AutoplayUmaHelper_h | 145 #endif // AutoplayUmaHelper_h |
| OLD | NEW |