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

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: Fixed the java enum comment 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 1d90b0d8fedb9d495cd032a65a8c456d2a276532..c812addeafe4fcdf05b0df3990075b6e0e1ce6d5 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"
@@ -444,7 +445,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)),
@@ -3168,12 +3168,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() {
@@ -3403,10 +3408,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();
@@ -3764,8 +3767,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