Chromium Code Reviews| 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 d613dc22f51163e74da3d2dd1829566b0a6c534b..48c393d1183581c76c0fccf189cc0dc1c93c016c 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 |
| @@ -93,6 +93,15 @@ Polymer({ |
| }, |
| /** |
| + * Whether a sink is currently trying to create a route. |
| + * @type {boolean} |
| + */ |
| + isLaunching: { |
| + type: Boolean, |
| + value: false, |
| + }, |
| + |
| + /** |
| * The issue to show. |
| * @type {?media_router.Issue} |
| */ |
| @@ -393,6 +402,17 @@ Polymer({ |
| }, |
| /** |
| + * @param {boolean} Whether or not there exists a sink trying to create a new |
| + * route in general. |
| + * @param {boolean} Whether or not a specific sink is trying to create a new |
| + * route. |
| + * @private |
| + */ |
| + computeSinkIsLaunching_: function(isLaunching, isSinkLaunching) { |
|
imcheng
2015/10/02 21:57:30
why can't we check only isSinkLaunching ? If isSin
apacible
2015/10/02 23:45:16
Not necessarily.
The sink list isn't updated on
|
| + return isLaunching && isSinkLaunching; |
| + }, |
| + |
| + /** |
| * @param {!Array<!media_router.Sink>} The list of sinks. |
| * @return {boolean} Whether or not to hide the sink list. |
| * @private |
| @@ -422,17 +442,6 @@ Polymer({ |
| }, |
| /** |
| - * Checks if there is a sink whose isLaunching is true. |
| - * |
| - * @param {!Array<!media_router.Sink>} sinks |
| - * @return {boolean} |
| - * @private |
| - */ |
| - isLaunching_: function(sinks) { |
| - return sinks.some(function(sink) { return sink.isLaunching; }); |
| - }, |
| - |
| - /** |
| * Updates |currentView_| if the dialog had just opened and there's |
| * only one local route. |
| * |
| @@ -485,7 +494,7 @@ Polymer({ |
| */ |
| onCreateRouteResponseReceived: function(sinkId, route) { |
| this.setLaunchState_(sinkId, false); |
| - // TODO(apacible) Show launch failure. |
| + // The provider will handle sending an issue for a failed route request. |
| if (!route) |
| return; |
| @@ -569,6 +578,9 @@ Polymer({ |
| this.sinkList.forEach(function(sink) { |
| this.sinkMap_[sink.id] = sink; |
| }, this); |
| + |
| + this.isLaunching = |
| + this.sinkList.some(function(sink) { return sink.isLaunching; }); |
| }, |
| /** |
| @@ -583,6 +595,7 @@ Polymer({ |
| for (var index = 0; index < this.sinkList.length; index++) { |
| if (this.sinkList[index].id == sinkId) { |
| this.set(['sinkList', index, 'isLaunching'], isLaunching); |
| + this.isLaunching = isLaunching; |
| return; |
| } |
| } |
| @@ -609,7 +622,7 @@ Polymer({ |
| var route = this.sinkToRouteMap_[sink.id]; |
| if (route) { |
| this.showRouteDetails_(route); |
| - } else if (!this.isLaunching_(this.sinkList)) { |
| + } else if (!this.isLaunching) { |
| // Allow one launch at a time. |
| this.setLaunchState_(sink.id, true); |
| this.fire('create-route', { |