| 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 |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 void maybeStopRecordingMutedVideoPlayMethodBecomeVisible(bool isVisible); | 71 void maybeStopRecordingMutedVideoPlayMethodBecomeVisible(bool isVisible); |
| 72 | 72 |
| 73 void maybeStartRecordingMutedVideoOffscreenDuration(); | 73 void maybeStartRecordingMutedVideoOffscreenDuration(); |
| 74 void maybeStopRecordingMutedVideoOffscreenDuration(); | 74 void maybeStopRecordingMutedVideoOffscreenDuration(); |
| 75 | 75 |
| 76 void onVisibilityChangedForMutedVideoOffscreenDuration(bool isVisibile); | 76 void onVisibilityChangedForMutedVideoOffscreenDuration(bool isVisibile); |
| 77 void onVisibilityChangedForMutedVideoPlayMethodBecomeVisible(bool isVisible); | 77 void onVisibilityChangedForMutedVideoPlayMethodBecomeVisible(bool isVisible); |
| 78 | 78 |
| 79 bool shouldListenToUnloadEvent() const; | 79 bool shouldListenToUnloadEvent() const; |
| 80 | 80 |
| 81 // The autoplay source. Use AutoplaySource::NumberOfSources for invalid source
. | 81 // The autoplay source. Use AutoplaySource::NumberOfSources for invalid |
| 82 // source. |
| 82 AutoplaySource m_source; | 83 AutoplaySource m_source; |
| 83 // The media element this UMA helper is attached to. |m_element| owns |this|. | 84 // The media element this UMA helper is attached to. |m_element| owns |this|. |
| 84 Member<HTMLMediaElement> m_element; | 85 Member<HTMLMediaElement> m_element; |
| 85 | 86 |
| 86 // The observer is used to observe whether a muted video autoplaying by play() | 87 // The observer is used to observe whether a muted video autoplaying by play() |
| 87 // method become visible at some point. | 88 // method become visible at some point. |
| 88 // The UMA is pending for recording as long as this observer is non-null. | 89 // The UMA is pending for recording as long as this observer is non-null. |
| 89 Member<ElementVisibilityObserver> m_mutedVideoPlayMethodVisibilityObserver; | 90 Member<ElementVisibilityObserver> m_mutedVideoPlayMethodVisibilityObserver; |
| 90 | 91 |
| 91 // ----------------------------------------------------------------------- | 92 // ----------------------------------------------------------------------- |
| 92 // Variables used for recording the duration of autoplay muted video playing o
ffscreen. | 93 // Variables used for recording the duration of autoplay muted video playing |
| 93 // The variables are valid when |m_autoplayOffscrenVisibilityObserver| is non-
null. | 94 // offscreen. The variables are valid when |
| 95 // |m_autoplayOffscrenVisibilityObserver| is non-null. |
| 94 // The recording stops whenever the playback pauses or the page is unloaded. | 96 // The recording stops whenever the playback pauses or the page is unloaded. |
| 95 | 97 |
| 96 // The starting time of autoplaying muted video. | 98 // The starting time of autoplaying muted video. |
| 97 int64_t m_mutedVideoAutoplayOffscreenStartTimeMS; | 99 int64_t m_mutedVideoAutoplayOffscreenStartTimeMS; |
| 98 | 100 |
| 99 // The duration an autoplaying muted video has been in offscreen. | 101 // The duration an autoplaying muted video has been in offscreen. |
| 100 int64_t m_mutedVideoAutoplayOffscreenDurationMS; | 102 int64_t m_mutedVideoAutoplayOffscreenDurationMS; |
| 101 | 103 |
| 102 // Whether an autoplaying muted video is visible. | 104 // Whether an autoplaying muted video is visible. |
| 103 bool m_isVisible; | 105 bool m_isVisible; |
| 104 | 106 |
| 105 // The observer is used to observer an autoplaying muted video changing it's v
isibility, | 107 // The observer is used to observer an autoplaying muted video changing it's |
| 106 // which is used for offscreen duration UMA. | 108 // visibility, which is used for offscreen duration UMA. The UMA is pending |
| 107 // The UMA is pending for recording as long as this observer is non-null. | 109 // for recording as long as this observer is non-null. |
| 108 Member<ElementVisibilityObserver> | 110 Member<ElementVisibilityObserver> |
| 109 m_mutedVideoOffscreenDurationVisibilityObserver; | 111 m_mutedVideoOffscreenDurationVisibilityObserver; |
| 110 }; | 112 }; |
| 111 | 113 |
| 112 } // namespace blink | 114 } // namespace blink |
| 113 | 115 |
| 114 #endif // AutoplayUmaHelper_h | 116 #endif // AutoplayUmaHelper_h |
| OLD | NEW |