Index: third_party/WebKit/Source/modules/remoteplayback/RemotePlayback.h |
diff --git a/third_party/WebKit/Source/modules/remoteplayback/RemotePlayback.h b/third_party/WebKit/Source/modules/remoteplayback/RemotePlayback.h |
index 4b328004ab74680e393cdf0dbacfdb852607dd2a..cc6a02dd7bf8a68b111210738153bb1f7df22931 100644 |
--- a/third_party/WebKit/Source/modules/remoteplayback/RemotePlayback.h |
+++ b/third_party/WebKit/Source/modules/remoteplayback/RemotePlayback.h |
@@ -13,6 +13,7 @@ |
#include "modules/ModulesExport.h" |
#include "platform/heap/Handle.h" |
#include "platform/wtf/Compiler.h" |
+#include "platform/wtf/Functional.h" |
#include "platform/wtf/text/AtomicString.h" |
#include "platform/wtf/text/WTFString.h" |
#include "public/platform/modules/remoteplayback/WebRemotePlaybackAvailability.h" |
@@ -71,14 +72,46 @@ class MODULES_EXPORT RemotePlayback final |
DEFINE_ATTRIBUTE_EVENT_LISTENER(disconnect); |
DECLARE_VIRTUAL_TRACE(); |
- DECLARE_VIRTUAL_TRACE_WRAPPERS(); |
private: |
+ friend class MediaControlCastButtonElement; |
+ friend class MediaControlsMediaEventListener; |
mlamouri (slow - plz ping)
2017/04/25 12:19:21
Do you need these for PromptInternal() and GetStat
whywhat
2017/04/25 15:45:37
Prompt and State are used by the button.
Watch/Can
|
friend class V8RemotePlayback; |
friend class RemotePlaybackTest; |
+ // Wraps either a WTF::Closure or RemotePlaybackAvailabilityCallback object |
+ // to be kept in the |availability_callbacks_| map. |
+ class AvailabilityCallback final |
+ : public GarbageCollectedFinalized<AvailabilityCallback> { |
mlamouri (slow - plz ping)
2017/04/25 12:19:21
Do you need to declare the class here? I mean, apa
whywhat
2017/04/25 15:45:37
Would you prefer it to be in a separate header/cpp
whywhat
2017/04/25 22:31:23
It's needed to be in the header since it's used by
|
+ WTF_MAKE_NONCOPYABLE(AvailabilityCallback); |
+ |
+ public: |
+ explicit AvailabilityCallback(RemotePlaybackAvailabilityCallback*); |
+ explicit AvailabilityCallback(std::unique_ptr<WTF::Closure>); |
+ ~AvailabilityCallback() = default; |
+ |
+ void Run(RemotePlayback*, bool new_availability); |
+ |
+ DECLARE_VIRTUAL_TRACE_WRAPPERS(); |
+ DEFINE_INLINE_VIRTUAL_TRACE() {} |
+ |
+ private: |
+ // Only one of these members must be set. |
+ TraceWrapperMember<RemotePlaybackAvailabilityCallback> bindings_cb_; |
+ std::unique_ptr<WTF::Closure> internal_cb_; |
+ }; |
+ |
explicit RemotePlayback(HTMLMediaElement&); |
+ // The implementation of prompt(). Used by the native remote playback button. |
+ void PromptInternal(); |
+ |
+ // The implementation of watchAvailability() and cancelWatchAvailability(). |
+ int WatchAvailabilityInternal(AvailabilityCallback*); |
+ bool CancelWatchAvailabilityInternal(int id); |
+ |
+ WebRemotePlaybackState GetState() const { return state_; } |
+ |
// Calls the specified availability callback with the current availability. |
// Need a void() method to post it as a task. |
void NotifyInitialAvailability(int callback_id); |
@@ -91,8 +124,7 @@ class MODULES_EXPORT RemotePlayback final |
WebRemotePlaybackState state_; |
WebRemotePlaybackAvailability availability_; |
- HeapHashMap<int, TraceWrapperMember<RemotePlaybackAvailabilityCallback>> |
- availability_callbacks_; |
+ HeapHashMap<int, Member<AvailabilityCallback>> availability_callbacks_; |
Member<HTMLMediaElement> media_element_; |
Member<ScriptPromiseResolver> prompt_promise_resolver_; |
}; |