Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(40)

Unified Diff: third_party/WebKit/Source/modules/remoteplayback/RemotePlayback.h

Issue 2890633003: [Blink,RemotePlayback] Use PresentationController for availability (Closed)
Patch Set: Limited to Blink only, rebased Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 c6b28503b26f27c0a27e1ce0e5a648d23d8edddd..7d002cb35ff8b47cf7df295de623df35c2acd79d 100644
--- a/third_party/WebKit/Source/modules/remoteplayback/RemotePlayback.h
+++ b/third_party/WebKit/Source/modules/remoteplayback/RemotePlayback.h
@@ -15,6 +15,9 @@
#include "platform/wtf/Compiler.h"
#include "platform/wtf/text/AtomicString.h"
#include "platform/wtf/text/WTFString.h"
+#include "public/platform/WebURL.h"
+#include "public/platform/WebVector.h"
+#include "public/platform/modules/presentation/WebPresentationAvailabilityObserver.h"
#include "public/platform/modules/remoteplayback/WebRemotePlaybackAvailability.h"
#include "public/platform/modules/remoteplayback/WebRemotePlaybackClient.h"
#include "public/platform/modules/remoteplayback/WebRemotePlaybackState.h"
@@ -30,7 +33,8 @@ class ScriptState;
class MODULES_EXPORT RemotePlayback final
: public EventTargetWithInlineData,
public ActiveScriptWrappable<RemotePlayback>,
- NON_EXPORTED_BASE(public WebRemotePlaybackClient) {
+ NON_EXPORTED_BASE(public WebRemotePlaybackClient),
+ public WebPresentationAvailabilityObserver {
DEFINE_WRAPPERTYPEINFO();
USING_GARBAGE_COLLECTED_MIXIN(RemotePlayback);
@@ -73,11 +77,16 @@ class MODULES_EXPORT RemotePlayback final
WebRemotePlaybackState GetState() const { return state_; }
+ // WebPresentationAvailabilityObserver implementation.
+ void AvailabilityChanged(bool) override;
+ const WebVector<WebURL>& Urls() const override;
mark a. foltz 2017/05/31 21:16:41 Can this method have a more specific name?
+
// WebRemotePlaybackClient implementation.
void StateChanged(WebRemotePlaybackState) override;
void AvailabilityChanged(WebRemotePlaybackAvailability) override;
void PromptCancelled() override;
bool RemotePlaybackAvailable() const override;
+ void SourceChanged(const WebURL&) override;
// ScriptWrappable implementation.
bool HasPendingActivity() const final;
@@ -100,12 +109,23 @@ class MODULES_EXPORT RemotePlayback final
// Need a void() method to post it as a task.
void NotifyInitialAvailability(int callback_id);
+ // Starts or stops listening if there're both
+ // registered availability callbacks and a valid source set.
+ void UpdateListeningState();
+
+ // Fills |availability_urls_| with the info about the given source.
+ // TODO(avayvod): support extra info fetched by the video stack and multiple
+ // sources.
+ void UpdateAvailabilityUrls(const WebURL& source);
+
WebRemotePlaybackState state_;
WebRemotePlaybackAvailability availability_;
HeapHashMap<int, TraceWrapperMember<AvailabilityCallbackWrapper>>
availability_callbacks_;
Member<HTMLMediaElement> media_element_;
Member<ScriptPromiseResolver> prompt_promise_resolver_;
+ WebVector<WebURL> availability_urls_;
mark a. foltz 2017/05/31 21:16:41 Only one element here seems to be used at any one
+ bool is_listening_;
};
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698