| 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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 | 60 |
| 61 DECLARE_VIRTUAL_TRACE(); | 61 DECLARE_VIRTUAL_TRACE(); |
| 62 | 62 |
| 63 private: | 63 private: |
| 64 explicit AutoplayUmaHelper(HTMLMediaElement*); | 64 explicit AutoplayUmaHelper(HTMLMediaElement*); |
| 65 | 65 |
| 66 void handleEvent(ExecutionContext*, Event*) override; | 66 void handleEvent(ExecutionContext*, Event*) override; |
| 67 | 67 |
| 68 void handlePlayingEvent(); | 68 void handlePlayingEvent(); |
| 69 void handlePauseEvent(); | 69 void handlePauseEvent(); |
| 70 void handleUnloadEvent(); | 70 void handlePageVisibilityChangeEvent(); |
| 71 | 71 |
| 72 void maybeUnregisterUnloadListener(); | 72 void maybeUnregisterPageVisibilityChangeListener(); |
| 73 | 73 |
| 74 void maybeStartRecordingMutedVideoPlayMethodBecomeVisible(); | 74 void maybeStartRecordingMutedVideoPlayMethodBecomeVisible(); |
| 75 void maybeStopRecordingMutedVideoPlayMethodBecomeVisible(bool isVisible); | 75 void maybeStopRecordingMutedVideoPlayMethodBecomeVisible(bool isVisible); |
| 76 | 76 |
| 77 void maybeStartRecordingMutedVideoOffscreenDuration(); | 77 void maybeStartRecordingMutedVideoOffscreenDuration(); |
| 78 void maybeStopRecordingMutedVideoOffscreenDuration(); | 78 void maybeStopRecordingMutedVideoOffscreenDuration(); |
| 79 | 79 |
| 80 void onVisibilityChangedForMutedVideoOffscreenDuration(bool isVisibile); | 80 void onVisibilityChangedForMutedVideoOffscreenDuration(bool isVisibile); |
| 81 void onVisibilityChangedForMutedVideoPlayMethodBecomeVisible(bool isVisible); | 81 void onVisibilityChangedForMutedVideoPlayMethodBecomeVisible(bool isVisible); |
| 82 | 82 |
| 83 bool shouldListenToUnloadEvent() const; | 83 bool shouldListenToPageVisibilityChangeEvent() const; |
| 84 | 84 |
| 85 // The autoplay source. Use AutoplaySource::NumberOfSources for invalid | 85 // The autoplay source. Use AutoplaySource::NumberOfSources for invalid |
| 86 // source. | 86 // source. |
| 87 AutoplaySource m_source; | 87 AutoplaySource m_source; |
| 88 // The media element this UMA helper is attached to. |m_element| owns |this|. | 88 // The media element this UMA helper is attached to. |m_element| owns |this|. |
| 89 Member<HTMLMediaElement> m_element; | 89 Member<HTMLMediaElement> m_element; |
| 90 | 90 |
| 91 // The observer is used to observe whether a muted video autoplaying by play() | 91 // The observer is used to observe whether a muted video autoplaying by play() |
| 92 // method become visible at some point. | 92 // method become visible at some point. |
| 93 // The UMA is pending for recording as long as this observer is non-null. | 93 // The UMA is pending for recording as long as this observer is non-null. |
| (...skipping 17 matching lines...) Expand all Loading... |
| 111 // The observer is used to observer an autoplaying muted video changing it's | 111 // The observer is used to observer an autoplaying muted video changing it's |
| 112 // visibility, which is used for offscreen duration UMA. The UMA is pending | 112 // visibility, which is used for offscreen duration UMA. The UMA is pending |
| 113 // for recording as long as this observer is non-null. | 113 // for recording as long as this observer is non-null. |
| 114 Member<ElementVisibilityObserver> | 114 Member<ElementVisibilityObserver> |
| 115 m_mutedVideoOffscreenDurationVisibilityObserver; | 115 m_mutedVideoOffscreenDurationVisibilityObserver; |
| 116 }; | 116 }; |
| 117 | 117 |
| 118 } // namespace blink | 118 } // namespace blink |
| 119 | 119 |
| 120 #endif // AutoplayUmaHelper_h | 120 #endif // AutoplayUmaHelper_h |
| OLD | NEW |