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

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

Issue 1478163002: [Cast,Android,Presentation API] Split CastRouteController into session and media routes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removed some unnecessary changes Created 5 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: chrome/android/java/src/org/chromium/chrome/browser/media/router/MediaRoute.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/media/router/MediaRoute.java b/chrome/android/java/src/org/chromium/chrome/browser/media/router/MediaRoute.java
new file mode 100644
index 0000000000000000000000000000000000000000..47ba6233f091ca6419b1adeb63570e9a6f246156
--- /dev/null
+++ b/chrome/android/java/src/org/chromium/chrome/browser/media/router/MediaRoute.java
@@ -0,0 +1,52 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+package org.chromium.chrome.browser.media.router;
+
+/**
+ * Contains all the info about the media route created by any {@link MediaRouteProvider}.
+ */
+public class MediaRoute {
+ private static final String MEDIA_ROUTE_ID_PREFIX = "route:";
+ private static final String MEDIA_ROUTE_ID_SEPARATOR = "/";
+
+ /**
+ * The unique id of the route, assigned by the {@link ChromeMediaRouter}.
+ */
+ public final String id;
+
+ /**
+ * The {@link MediaRouteProvider} unique id of the sink the route was created for.
+ */
+ public final String sinkId;
+
+ /**
+ * The presentation URL that the route was created for.
+ */
+ public final String sourceId;
+
+ /**
+ * The presentation id that was assigned to the route.
+ */
+ public final String presentationId;
+
+ public MediaRoute(String sinkId, String sourceId, String presentationId) {
+ this.id = createMediaRouteId(presentationId, sinkId, sourceId);
+ this.sinkId = sinkId;
+ this.sourceId = sourceId;
+ this.presentationId = presentationId;
+ }
+
+ private static String createMediaRouteId(
+ String presentationId, String sinkId, String sourceUrn) {
+ StringBuilder builder = new StringBuilder();
+ builder.append(MEDIA_ROUTE_ID_PREFIX);
+ builder.append(presentationId);
+ builder.append(MEDIA_ROUTE_ID_SEPARATOR);
+ builder.append(sinkId);
+ builder.append(MEDIA_ROUTE_ID_SEPARATOR);
+ builder.append(sourceUrn);
+ return builder.toString();
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698