OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 AutoplayPolicy_h | 5 #ifndef AutoplayPolicy_h |
6 #define AutoplayPolicy_h | 6 #define AutoplayPolicy_h |
7 | 7 |
8 #include "bindings/core/v8/Nullable.h" | 8 #include "bindings/core/v8/Nullable.h" |
9 #include "core/dom/ExceptionCode.h" | 9 #include "core/dom/ExceptionCode.h" |
10 #include "platform/heap/Handle.h" | 10 #include "platform/heap/Handle.h" |
| 11 #include "public/platform/WebMediaPlayerClient.h" |
11 | 12 |
12 namespace blink { | 13 namespace blink { |
13 | 14 |
14 class AutoplayUmaHelper; | 15 class AutoplayUmaHelper; |
15 class Document; | 16 class Document; |
16 class ElementVisibilityObserver; | 17 class ElementVisibilityObserver; |
17 class HTMLMediaElement; | 18 class HTMLMediaElement; |
18 | 19 |
19 // AutoplayPolicy is the class for handles autoplay logics. | 20 // AutoplayPolicy is the class for handles autoplay logics. |
20 class AutoplayPolicy final : public GarbageCollected<AutoplayPolicy> { | 21 class AutoplayPolicy final : public GarbageCollected<AutoplayPolicy> { |
(...skipping 28 matching lines...) Expand all Loading... |
49 | 50 |
50 // Unlock user gesture if a user gesture can be utilized. | 51 // Unlock user gesture if a user gesture can be utilized. |
51 void TryUnlockingUserGesture(); | 52 void TryUnlockingUserGesture(); |
52 | 53 |
53 // Return true if and only if a user gesture is requried for playback. Even | 54 // Return true if and only if a user gesture is requried for playback. Even |
54 // if isLockedPendingUserGesture() return true, this might return false if | 55 // if isLockedPendingUserGesture() return true, this might return false if |
55 // the requirement is currently overridden. This does not check if a user | 56 // the requirement is currently overridden. This does not check if a user |
56 // gesture is currently being processed. | 57 // gesture is currently being processed. |
57 bool IsGestureNeededForPlayback() const; | 58 bool IsGestureNeededForPlayback() const; |
58 | 59 |
| 60 // Called when source is initialized and loading starts. |
| 61 void OnLoadStarted(WebMediaPlayer::LoadType); |
| 62 |
59 DECLARE_VIRTUAL_TRACE(); | 63 DECLARE_VIRTUAL_TRACE(); |
60 | 64 |
61 private: | 65 private: |
62 friend class AutoplayUmaHelper; | 66 friend class AutoplayUmaHelper; |
63 friend class AutoplayUmaHelperTest; | 67 friend class AutoplayUmaHelperTest; |
64 | 68 |
65 // Start autoplaying the video element whenever its visible. | 69 // Start autoplaying the video element whenever its visible. |
66 void StartAutoplayMutedWhenVisible(); | 70 void StartAutoplayMutedWhenVisible(); |
67 | 71 |
68 // Returns whether the media element is eligible to autoplay muted. | 72 // Returns whether the media element is eligible to autoplay muted. |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 Member<ElementVisibilityObserver> autoplay_visibility_observer_; | 108 Member<ElementVisibilityObserver> autoplay_visibility_observer_; |
105 | 109 |
106 Member<AutoplayUmaHelper> autoplay_uma_helper_; | 110 Member<AutoplayUmaHelper> autoplay_uma_helper_; |
107 | 111 |
108 DISALLOW_COPY_AND_ASSIGN(AutoplayPolicy); | 112 DISALLOW_COPY_AND_ASSIGN(AutoplayPolicy); |
109 }; | 113 }; |
110 | 114 |
111 } // namespace blink | 115 } // namespace blink |
112 | 116 |
113 #endif // AutoplayPolicy_h | 117 #endif // AutoplayPolicy_h |
OLD | NEW |