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 d88e808f0a30e22ff9d80f54aff8322d2547ad18..09392cdae7020a8f02f3cc5c58a815ddce1bdef0 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 |
| @@ -204,6 +204,11 @@ Polymer({ |
| type: Array, |
| value: [], |
| }, |
| + |
| + canJoin_: { |
|
imcheng
2015/11/03 19:28:03
not needed?
|
| + type: Boolean, |
| + value: false, |
| + }, |
| }, |
| listeners: { |
| @@ -289,8 +294,8 @@ Polymer({ |
| */ |
| computeHeaderHidden_: function(view, issue) { |
| return view == media_router.MediaRouterView.ROUTE_DETAILS || |
| - (view == media_router.MediaRouterView.SINK_LIST && |
| - issue && issue.isBlocking); |
| + (view == media_router.MediaRouterView.SINK_LIST && issue && |
| + issue.isBlocking); |
| }, |
| /** |
| @@ -370,7 +375,7 @@ Polymer({ |
| */ |
| computeRouteDetailsHidden_: function(view, issue) { |
| return view != media_router.MediaRouterView.ROUTE_DETAILS || |
| - (issue && issue.isBlocking); |
| + (issue && issue.isBlocking); |
| }, |
| /** |
| @@ -476,7 +481,7 @@ Polymer({ |
| */ |
| computeSinkListViewHidden_: function(view, issue) { |
| return view != media_router.MediaRouterView.SINK_LIST || |
| - (issue && issue.isBlocking); |
| + (issue && issue.isBlocking); |
| }, |
| /** |
| @@ -484,9 +489,7 @@ Polymer({ |
| * @return {boolean} Whether or not to hide the spinner. |
| * @private |
| */ |
| - computeSpinnerHidden_: function(justOpened) { |
| - return !justOpened; |
| - }, |
| + computeSpinnerHidden_: function(justOpened) { return !justOpened; }, |
| /** |
| * Helper function to locate the CastMode object with the given type in |
| @@ -543,7 +546,7 @@ Polymer({ |
| // defaultCastModeList and nonDefaultCastModeList. |
| var clickedMode = |
| this.$.defaultCastModeList.itemForElement(event.target) || |
| - this.$.nonDefaultCastModeList.itemForElement(event.target); |
| + this.$.nonDefaultCastModeList.itemForElement(event.target); |
| if (!clickedMode) |
| return; |
| @@ -578,9 +581,15 @@ Polymer({ |
| if (!route) |
| return; |
| + |
| + console.log('container.onCreateRouteResponseReceived: ' + sinkId); |
| + |
| // Check that |sinkId| exists. |
| - if (!this.sinkMap_[sinkId]) |
| + if (!this.sinkMap_[sinkId]) { |
| + console.log('SINK DID NOT MATCH ANY OF FOLLOWING: '); |
| + this.allSinks.forEach(function(sink) { console.log(sink.id); }, this); |
| return; |
| + } |
| // If there is an existing route associated with the same sink, its |
| // |sinkToRouteMap_| entry will be overwritten with that of the new route, |
| @@ -616,9 +625,7 @@ Polymer({ |
| if (this.timerIdList_.length == 0) |
| return; |
| - this.timerIdList_.forEach(function(id) { |
| - clearTimeout(id); |
| - }, this); |
| + this.timerIdList_.forEach(function(id) { clearTimeout(id); }, this); |
| this.timerIdList_ = []; |
| }, |
| @@ -755,6 +762,7 @@ Polymer({ |
| */ |
| showRouteDetails_: function(route) { |
| this.currentRoute_ = route; |
| + media_router.browserApi.canJoinRoute(route); |
|
imcheng
2015/11/03 19:28:02
This flow seems a bit weird to me. It feels like c
|
| this.currentView_ = media_router.MediaRouterView.ROUTE_DETAILS; |
| }, |
| @@ -767,6 +775,18 @@ Polymer({ |
| this.currentView_ = media_router.MediaRouterView.SINK_LIST; |
| }, |
| + |
| + setCanJoin: function(canJoin) { this.canJoin_ = canJoin; }, |
| + /** |
| + * Determines if the join button should be shown. |
| + * |
| + * @param {!media_router.Route} route The route to join. |
| + * @private |
| + */ |
| + computerCanJoin_: function(route) { |
| + return route && !route.isLocal && this.canJoin_; |
| + }, |
| + |
| /** |
| * Starts a timer which fires a close-dialog event if the timer has not been |
| * cleared within three seconds. |
| @@ -775,6 +795,7 @@ Polymer({ |
| */ |
| startTapTimer_: function() { |
| var id = setTimeout(function() { |
| + console.log('END TAP TIMER'); |
| this.fire('close-dialog'); |
| }.bind(this), 3000 /* 3 seconds */); |