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

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/media/remote/RemoteMediaPlayerBridge.java

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
« no previous file with comments | « no previous file | chrome/browser/DEPS » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/android/java/src/org/chromium/chrome/browser/media/remote/RemoteMediaPlayerBridge.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/media/remote/RemoteMediaPlayerBridge.java b/chrome/android/java/src/org/chromium/chrome/browser/media/remote/RemoteMediaPlayerBridge.java
index 33dbff5861d5a360981a0252e50ee8f5f304395f..829330db0f50a6a73ae84bad1ea7748a80ccc773 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/media/remote/RemoteMediaPlayerBridge.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/media/remote/RemoteMediaPlayerBridge.java
@@ -9,6 +9,7 @@ import android.graphics.Bitmap;
import org.chromium.base.Log;
import org.chromium.base.annotations.CalledByNative;
import org.chromium.base.annotations.JNINamespace;
+import org.chromium.blink_public.platform.modules.remoteplayback.WebRemotePlaybackAvailability;
import org.chromium.chrome.browser.media.remote.RemoteVideoInfo.PlayerState;
/**
@@ -318,9 +319,19 @@ public class RemoteMediaPlayerBridge {
}
private void onRouteAvailabilityChange() {
+ Log.d(TAG, "onRouteAvailabilityChange: " + mRouteIsAvailable + ", " + mIsPlayable);
if (mNativeRemoteMediaPlayerBridge == 0) return;
- boolean usable = mRouteIsAvailable && mIsPlayable;
- nativeOnRouteAvailabilityChanged(mNativeRemoteMediaPlayerBridge, usable);
+
+ int availability = WebRemotePlaybackAvailability.DeviceNotAvailable;
+ if (!mRouteIsAvailable && !mIsPlayable) {
+ availability = WebRemotePlaybackAvailability.SourceNotSupported;
+ } else if (mRouteIsAvailable && mIsPlayable) {
+ availability = WebRemotePlaybackAvailability.DeviceAvailable;
+ } else if (mRouteIsAvailable) {
+ // mIsPlayable is false here.
+ availability = WebRemotePlaybackAvailability.SourceNotCompatible;
+ }
+ nativeOnRouteAvailabilityChanged(mNativeRemoteMediaPlayerBridge, availability);
}
@CalledByNative
@@ -354,8 +365,8 @@ public class RemoteMediaPlayerBridge {
private native void nativeOnPaused(long nativeRemoteMediaPlayerBridge);
private native void nativeOnRouteUnselected(long nativeRemoteMediaPlayerBridge);
private native void nativeOnPlaybackFinished(long nativeRemoteMediaPlayerBridge);
- private native void nativeOnRouteAvailabilityChanged(long nativeRemoteMediaPlayerBridge,
- boolean available);
+ private native void nativeOnRouteAvailabilityChanged(
+ long nativeRemoteMediaPlayerBridge, int availability);
private native void nativeOnCancelledRemotePlaybackRequest(long nativeRemoteMediaPlayerBridge);
private native String nativeGetTitle(long nativeRemoteMediaPlayerBridge);
private native void nativePauseLocal(long nativeRemoteMediaPlayerBridge);
« no previous file with comments | « no previous file | chrome/browser/DEPS » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698