Chromium Code Reviews| 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 cfab31c0e69da9310129aaa808abe02daf88f73d..ae3385a6b9bbf7d6ec2588b8fdd72163592679ce 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; |
| @@ -55,14 +70,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. |
|
Zhiqiang Zhang (Slow)
2016/10/13 15:23:11
s/Need a/Need to be a
|
| + 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; |
| }; |