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

Unified Diff: third_party/WebKit/Source/core/html/HTMLMediaElement.cpp

Issue 2480003002: [RemotePlayback] Keep track of source compatibility and reject prompt() correspondingly (Closed)
Patch Set: Rebased Created 4 years, 1 month 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/core/html/HTMLMediaElement.cpp
diff --git a/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp b/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp
index c91a76936a78f4f352f125011fc1b9a8f8bae2d1..dfc1ad52404f434b89a679562625f7dac186cb56 100644
--- a/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp
+++ b/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp
@@ -89,6 +89,7 @@
#include "public/platform/WebInbandTextTrack.h"
#include "public/platform/WebMediaPlayerSource.h"
#include "public/platform/WebMediaStream.h"
+#include "public/platform/modules/remoteplayback/WebRemotePlaybackAvailability.h"
#include "public/platform/modules/remoteplayback/WebRemotePlaybackClient.h"
#include "public/platform/modules/remoteplayback/WebRemotePlaybackState.h"
#include "wtf/CurrentTime.h"
@@ -445,7 +446,6 @@ HTMLMediaElement::HTMLMediaElement(const QualifiedName& tagName,
m_shouldPerformAutomaticTrackSelection(true),
m_tracksAreReady(true),
m_processingPreferenceChange(false),
- m_remoteRoutesAvailable(false),
m_playingRemotely(false),
m_inOverlayFullscreenVideo(false),
m_audioTracks(this, AudioTrackList::create(*this)),
@@ -3162,12 +3162,17 @@ void HTMLMediaElement::requestSeek(double time) {
setCurrentTime(time);
}
-void HTMLMediaElement::remoteRouteAvailabilityChanged(bool routesAvailable) {
- m_remoteRoutesAvailable = routesAvailable;
+void HTMLMediaElement::remoteRouteAvailabilityChanged(
+ WebRemotePlaybackAvailability availability) {
+ if (remotePlaybackClient())
+ remotePlaybackClient()->availabilityChanged(availability);
if (mediaControls())
mediaControls()->refreshCastButtonVisibility();
- if (remotePlaybackClient())
- remotePlaybackClient()->availabilityChanged(routesAvailable);
+}
+
+bool HTMLMediaElement::hasRemoteRoutes() const {
+ return remotePlaybackClient() &&
+ remotePlaybackClient()->remotePlaybackAvailable();
}
void HTMLMediaElement::connectedToRemoteDevice() {
@@ -3397,10 +3402,8 @@ void HTMLMediaElement::clearMediaPlayer() {
m_loadState = WaitingForSource;
// We can't cast if we don't have a media player.
- m_remoteRoutesAvailable = false;
m_playingRemotely = false;
- if (mediaControls())
- mediaControls()->refreshCastButtonVisibilityWithoutUpdate();
+ remoteRouteAvailabilityChanged(WebRemotePlaybackAvailability::Unknown);
if (layoutObject())
layoutObject()->setShouldDoFullPaintInvalidation();
@@ -3758,8 +3761,8 @@ void HTMLMediaElement::resetMediaPlayerAndMediaSource() {
}
// We haven't yet found out if any remote routes are available.
- m_remoteRoutesAvailable = false;
m_playingRemotely = false;
+ remoteRouteAvailabilityChanged(WebRemotePlaybackAvailability::Unknown);
if (m_audioSourceNode)
getAudioSourceProvider().setClient(m_audioSourceNode);

Powered by Google App Engine
This is Rietveld 408576698