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

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/media/router/cast/MediaSink.java

Issue 1294133002: [Presentation API, MediaRouter] Routing from media sink selection to route creation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@media-router-discovery-2
Patch Set: Fixed comments and naming and DCHECKs Created 5 years, 4 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: chrome/android/java/src/org/chromium/chrome/browser/media/router/cast/MediaSink.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/media/router/cast/MediaSink.java b/chrome/android/java/src/org/chromium/chrome/browser/media/router/cast/MediaSink.java
index 3ea7e098c7aabc1d9efe8401f7a8a216e53e4be1..382c6e69ccfccede1409cedd8e7709bc4f8af29a 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/media/router/cast/MediaSink.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/media/router/cast/MediaSink.java
@@ -5,6 +5,7 @@
package org.chromium.chrome.browser.media.router.cast;
import android.support.v7.media.MediaRouter;
+import android.support.v7.media.MediaRouter.RouteInfo;
/**
* A common descriptor of a device that can present some URI.
@@ -14,19 +15,33 @@ public class MediaSink {
private final String mId;
private final String mName;
+ /**
+ * Constructor.
+ * @param id A unique identifier of the sink.
+ * @param name A user friendly name of the sink.
+ */
public MediaSink(String id, String name) {
mId = id;
mName = name;
}
+ /**
+ * @return The unique identifier of the sink.
+ */
public String getId() {
return mId;
}
+ /**
+ * @return The user friendly name of the sink.
+ */
public String getName() {
return mName;
}
+ /**
+ * @return The valid URN representing the sink.
+ */
public String getUrn() {
return CAST_SINK_URN_PREFIX + getId();
}
@@ -50,14 +65,18 @@ public class MediaSink {
return result;
}
- static MediaSink fromRoute(MediaRouter.RouteInfo route) {
- return new MediaSink(
- route.getId(),
- route.getName());
- }
-
@Override
public String toString() {
return String.format("MediaSink: %s, %s", getId(), getName());
}
+
+ /**
+ * @param route The route information provided by Android.
+ * @return A new MediaSink instance corresponding to the specified {@link RouteInfo}.
+ */
+ public static MediaSink fromRoute(MediaRouter.RouteInfo route) {
+ return new MediaSink(
+ route.getId(),
+ route.getName());
+ }
}

Powered by Google App Engine
This is Rietveld 408576698