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 RemotePlayback_h | 5 #ifndef RemotePlayback_h |
6 #define RemotePlayback_h | 6 #define RemotePlayback_h |
7 | 7 |
8 #include "bindings/core/v8/ActiveScriptWrappable.h" | 8 #include "bindings/core/v8/ActiveScriptWrappable.h" |
9 #include "bindings/core/v8/ScriptPromise.h" | 9 #include "bindings/core/v8/ScriptPromise.h" |
10 #include "bindings/core/v8/TraceWrapperMember.h" | |
11 #include "core/dom/ExecutionContext.h" | 10 #include "core/dom/ExecutionContext.h" |
12 #include "core/events/EventTarget.h" | 11 #include "core/events/EventTarget.h" |
13 #include "modules/ModulesExport.h" | 12 #include "modules/ModulesExport.h" |
14 #include "platform/heap/Handle.h" | 13 #include "platform/heap/Handle.h" |
15 #include "platform/wtf/Compiler.h" | 14 #include "platform/wtf/Compiler.h" |
| 15 #include "platform/wtf/Functional.h" |
16 #include "platform/wtf/text/AtomicString.h" | 16 #include "platform/wtf/text/AtomicString.h" |
17 #include "platform/wtf/text/WTFString.h" | 17 #include "platform/wtf/text/WTFString.h" |
18 #include "public/platform/modules/remoteplayback/WebRemotePlaybackAvailability.h
" | 18 #include "public/platform/modules/remoteplayback/WebRemotePlaybackAvailability.h
" |
19 #include "public/platform/modules/remoteplayback/WebRemotePlaybackClient.h" | 19 #include "public/platform/modules/remoteplayback/WebRemotePlaybackClient.h" |
20 #include "public/platform/modules/remoteplayback/WebRemotePlaybackState.h" | 20 #include "public/platform/modules/remoteplayback/WebRemotePlaybackState.h" |
21 | 21 |
22 namespace blink { | 22 namespace blink { |
23 | 23 |
24 class HTMLMediaElement; | 24 class HTMLMediaElement; |
25 class RemotePlaybackAvailabilityCallback; | 25 class RemotePlaybackAvailabilityCallback; |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 String state() const; | 64 String state() const; |
65 | 65 |
66 // ScriptWrappable implementation. | 66 // ScriptWrappable implementation. |
67 bool HasPendingActivity() const final; | 67 bool HasPendingActivity() const final; |
68 | 68 |
69 DEFINE_ATTRIBUTE_EVENT_LISTENER(connecting); | 69 DEFINE_ATTRIBUTE_EVENT_LISTENER(connecting); |
70 DEFINE_ATTRIBUTE_EVENT_LISTENER(connect); | 70 DEFINE_ATTRIBUTE_EVENT_LISTENER(connect); |
71 DEFINE_ATTRIBUTE_EVENT_LISTENER(disconnect); | 71 DEFINE_ATTRIBUTE_EVENT_LISTENER(disconnect); |
72 | 72 |
73 DECLARE_VIRTUAL_TRACE(); | 73 DECLARE_VIRTUAL_TRACE(); |
74 DECLARE_VIRTUAL_TRACE_WRAPPERS(); | |
75 | 74 |
76 private: | 75 private: |
| 76 friend class MediaControlCastButtonElement; |
77 friend class V8RemotePlayback; | 77 friend class V8RemotePlayback; |
78 friend class RemotePlaybackTest; | 78 friend class RemotePlaybackTest; |
79 | 79 |
80 explicit RemotePlayback(HTMLMediaElement&); | 80 explicit RemotePlayback(HTMLMediaElement&); |
81 | 81 |
| 82 // The implementation of prompt(). Used by the native remote playback button. |
| 83 void PromptInternal(); |
| 84 |
| 85 // The implementation of watchAvailability() and cancelWatchAvailability(). |
| 86 int WatchAvailabilityInternal(std::unique_ptr<WTF::Closure> callback); |
| 87 bool CancelWatchAvailabilityInternal(int id); |
| 88 |
82 // Calls the specified availability callback with the current availability. | 89 // Calls the specified availability callback with the current availability. |
83 // Need a void() method to post it as a task. | 90 // Need a void() method to post it as a task. |
84 void NotifyInitialAvailability(int callback_id); | 91 void NotifyInitialAvailability(int callback_id); |
85 | 92 |
86 // WebRemotePlaybackClient implementation. | 93 // WebRemotePlaybackClient implementation. |
87 void StateChanged(WebRemotePlaybackState) override; | 94 void StateChanged(WebRemotePlaybackState) override; |
88 void AvailabilityChanged(WebRemotePlaybackAvailability) override; | 95 void AvailabilityChanged(WebRemotePlaybackAvailability) override; |
89 void PromptCancelled() override; | 96 void PromptCancelled() override; |
90 bool RemotePlaybackAvailable() const override; | 97 bool RemotePlaybackAvailable() const override; |
91 | 98 |
92 WebRemotePlaybackState state_; | 99 WebRemotePlaybackState state_; |
93 WebRemotePlaybackAvailability availability_; | 100 WebRemotePlaybackAvailability availability_; |
94 HeapHashMap<int, TraceWrapperMember<RemotePlaybackAvailabilityCallback>> | 101 HeapHashMap<int, Member<AvailabilityCallback>> availability_callbacks_; |
95 availability_callbacks_; | |
96 Member<HTMLMediaElement> media_element_; | 102 Member<HTMLMediaElement> media_element_; |
97 Member<ScriptPromiseResolver> prompt_promise_resolver_; | 103 Member<ScriptPromiseResolver> prompt_promise_resolver_; |
98 }; | 104 }; |
99 | 105 |
100 } // namespace blink | 106 } // namespace blink |
101 | 107 |
102 #endif // RemotePlayback_h | 108 #endif // RemotePlayback_h |
OLD | NEW |