| 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..65b7a6060fd15bab1be91043466cc089f0fef0fa 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,45 @@ class MODULES_EXPORT RemotePlayback final
|
| DEFINE_ATTRIBUTE_EVENT_LISTENER(disconnect);
|
|
|
| DECLARE_VIRTUAL_TRACE();
|
| - DECLARE_VIRTUAL_TRACE_WRAPPERS();
|
|
|
| private:
|
| + friend class MediaControlCastButtonElement;
|
| 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> {
|
| + 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 +123,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_;
|
| };
|
|
|