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 a1b3e7dbee4b51e52607ecd546d791292a0244f6..21beac067bb617356022bec8a0bb6aad2bf0915d 100644 |
--- a/third_party/WebKit/Source/modules/remoteplayback/RemotePlayback.h |
+++ b/third_party/WebKit/Source/modules/remoteplayback/RemotePlayback.h |
@@ -7,6 +7,7 @@ |
#include "bindings/core/v8/ActiveScriptWrappable.h" |
#include "bindings/core/v8/ScriptPromise.h" |
+#include "bindings/core/v8/ScriptState.h" |
#include "core/events/EventTarget.h" |
#include "modules/ModulesExport.h" |
#include "platform/heap/Handle.h" |
@@ -21,7 +22,7 @@ namespace blink { |
class ExecutionContext; |
class HTMLMediaElement; |
class LocalFrame; |
-class RemotePlaybackAvailability; |
+class RemotePlaybackAvailabilityCallback; |
class ScriptPromiseResolver; |
class MODULES_EXPORT RemotePlayback final |
@@ -38,7 +39,21 @@ class MODULES_EXPORT RemotePlayback final |
const WTF::AtomicString& interfaceName() const override; |
ExecutionContext* getExecutionContext() const override; |
- ScriptPromise getAvailability(ScriptState*); |
+ // Starts notifying the page about the changes to the remote playback devices |
+ // availability via the provided callback. May start the monitoring of remote |
+ // playback devices if it isn't running yet. |
+ ScriptPromise watchAvailability(ScriptState*, |
+ RemotePlaybackAvailabilityCallback*); |
+ |
+ // Cancels updating the page via the callback specified by its id. |
+ ScriptPromise cancelWatchAvailability(ScriptState*, int id); |
+ |
+ // Cancels all the callbacks watching remote playback availability changes |
+ // registered with this element. |
+ ScriptPromise cancelWatchAvailability(ScriptState*); |
+ |
+ // Shows the UI allowing user to change the remote playback state of the media |
+ // element (by picking a remote playback device from the list, for example). |
ScriptPromise prompt(ScriptState*); |
String state() const; |
@@ -57,14 +72,20 @@ class MODULES_EXPORT RemotePlayback final |
explicit RemotePlayback(HTMLMediaElement&); |
+ // Calls the specified availability callback with the current availability. |
+ // Need a void() method to post it as a task. |
+ void notifyInitialAvailability(int callbackId); |
+ |
// WebRemotePlaybackClient implementation. |
void stateChanged(WebRemotePlaybackState) override; |
void availabilityChanged(bool available) override; |
void promptCancelled() override; |
+ RefPtr<ScriptState> m_scriptState; |
WebRemotePlaybackState m_state; |
bool m_availability; |
- HeapVector<Member<RemotePlaybackAvailability>> m_availabilityObjects; |
+ HeapHashMap<int, Member<RemotePlaybackAvailabilityCallback>> |
+ m_availabilityCallbacks; |
Member<HTMLMediaElement> m_mediaElement; |
Member<ScriptPromiseResolver> m_promptPromiseResolver; |
}; |