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

Unified Diff: chrome/browser/resources/media_router/elements/media_router_container/media_router_container.js

Issue 1415103006: Non-Local Join for Media Router and Presentation API (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added Unit Tests 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/browser/resources/media_router/elements/media_router_container/media_router_container.js
diff --git a/chrome/browser/resources/media_router/elements/media_router_container/media_router_container.js b/chrome/browser/resources/media_router/elements/media_router_container/media_router_container.js
index a94a0c4ec513393d4779e6453c97743a43ca3ed9..13d36eea009d27abe767bb87401f45a9ab435789 100644
--- a/chrome/browser/resources/media_router/elements/media_router_container/media_router_container.js
+++ b/chrome/browser/resources/media_router/elements/media_router_container/media_router_container.js
@@ -132,6 +132,16 @@ Polymer({
},
/**
+ * The list of current joinable routes.
+ * @type {!Array<!media_router.Route>}
+ */
+ joinableRouteList: {
imcheng 2015/11/19 18:55:08 I am a bit confused by this. Why do we have a sepa
matt.boetger 2015/11/24 19:45:23 It depends where and when you want to set the 'can
+ type: Array,
+ value: [],
+ observer: 'rebuildRouteMaps_',
+ },
+
+ /**
* Maps media_router.Route.id to corresponding media_router.Route.
* @private {!Object<!string, !media_router.Route>}
*/
@@ -644,6 +654,7 @@ Polymer({
// We expect that each route in |routeList| maps to a unique sink.
this.routeList.forEach(function(route) {
+ route['canJoin'] = false;
imcheng 2015/11/19 18:55:08 Prefer adding canJoin as a field in Route class. D
matt.boetger 2015/11/24 19:45:23 Done.
this.routeMap_[route.id] = route;
tempSinkToRouteMap[route.sinkId] = route;
@@ -656,6 +667,23 @@ Polymer({
}
}, this);
+ if (this.joinableRouteList) {
+ // We expect that each route in |routeList| maps to a unique sink.
+ this.joinableRouteList.forEach(function(route) {
+ route['canJoin'] = true;
+ this.routeMap_[route.id] = route;
+ tempSinkToRouteMap[route.sinkId] = route;
+
+ if (route.isLocal) {
+ this.localRouteCount_++;
+
+ // It's OK if localRoute is updated multiple times; it is only used if
+ // |localRouteCount_| == 1, which implies it was only set once.
+ localRoute = route;
+ }
+ }, this);
+ }
+
// If |currentRoute_| is no longer active, clear |currentRoute_|. Also
// switch back to the SINK_PICKER view if the user is currently in the
// ROUTE_DETAILS view.

Powered by Google App Engine
This is Rietveld 408576698