| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // This Polymer element shows information from media that is currently cast | 5 // This Polymer element shows information from media that is currently cast |
| 6 // to a device. | 6 // to a device. |
| 7 Polymer({ | 7 Polymer({ |
| 8 is: 'route-details', | 8 is: 'route-details', |
| 9 | 9 |
| 10 properties: { | 10 properties: { |
| 11 /** | 11 /** |
| 12 * The text for the current casting activity status. | 12 * The text for the current casting activity status. |
| 13 * @private {string|undefined} | 13 * @private {string|undefined} |
| 14 */ | 14 */ |
| 15 activityStatus_: { | 15 activityStatus_: { |
| 16 type: String, | 16 type: String, |
| 17 }, | 17 }, |
| 18 | 18 |
| 19 /** | 19 /** |
| 20 * Whether the external container will accept change-route-source-click | 20 * Whether the external container will accept change-route-source-click |
| 21 * events. | 21 * events. |
| 22 * @private {boolean} | 22 * @private {boolean} |
| 23 */ | 23 */ |
| 24 changeRouteSourceAvailable_: { | 24 changeRouteSourceAvailable_: { |
| 25 type: Boolean, | 25 type: Boolean, |
| 26 computed: 'computeChangeRouteSourceAvailable_(route, sink,' + | 26 computed: 'computeChangeRouteSourceAvailable_(route, sink,' + |
| 27 'isAnySinkCurrentlyLaunching, shownCastModeValue)', | 27 'isAnySinkCurrentlyLaunching, shownCastModeValue)', |
| 28 }, | 28 }, |
| 29 | 29 |
| 30 /** | 30 /** |
| 31 * Whether a sink is currently launching in the container. | 31 * Whether a sink is currently launching in the container. |
| 32 * @type {boolean} | 32 * @type {boolean} |
| 33 */ | 33 */ |
| 34 isAnySinkCurrentlyLaunching: { | 34 isAnySinkCurrentlyLaunching: { |
| 35 type: Boolean, | 35 type: Boolean, |
| 36 value: false, | 36 value: false, |
| 37 }, | 37 }, |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 | 177 |
| 178 /** | 178 /** |
| 179 * Loads the custom controller if |route.customControllerPath| exists. | 179 * Loads the custom controller if |route.customControllerPath| exists. |
| 180 * Falls back to the default route details view otherwise, or if load fails. | 180 * Falls back to the default route details view otherwise, or if load fails. |
| 181 * Updates |activityStatus_| for the default view. | 181 * Updates |activityStatus_| for the default view. |
| 182 * | 182 * |
| 183 * @private | 183 * @private |
| 184 */ | 184 */ |
| 185 maybeLoadCustomController_: function() { | 185 maybeLoadCustomController_: function() { |
| 186 this.activityStatus_ = this.route ? | 186 this.activityStatus_ = this.route ? |
| 187 loadTimeData.getStringF('castingActivityStatus', | 187 loadTimeData.getStringF( |
| 188 this.route.description) : | 188 'castingActivityStatus', this.route.description) : |
| 189 ''; | 189 ''; |
| 190 | 190 |
| 191 if (!this.route || !this.route.customControllerPath) { | 191 if (!this.route || !this.route.customControllerPath) { |
| 192 this.isCustomControllerHidden_ = true; | 192 this.isCustomControllerHidden_ = true; |
| 193 return; | 193 return; |
| 194 } | 194 } |
| 195 | 195 |
| 196 // Show custom controller | 196 // Show custom controller |
| 197 var extensionview = this.$['custom-controller']; | 197 var extensionview = this.$['custom-controller']; |
| 198 | 198 |
| 199 // Do nothing if the url is the same and the view is not hidden. | 199 // Do nothing if the url is the same and the view is not hidden. |
| 200 if (this.route.customControllerPath == extensionview.src && | 200 if (this.route.customControllerPath == extensionview.src && |
| 201 !this.isCustomControllerHidden_) | 201 !this.isCustomControllerHidden_) |
| 202 return; | 202 return; |
| 203 | 203 |
| 204 var that = this; | 204 var that = this; |
| 205 extensionview.load(this.route.customControllerPath) | 205 extensionview.load(this.route.customControllerPath) |
| 206 .then(function() { | 206 .then( |
| 207 // Load was successful; show the custom controller. | 207 function() { |
| 208 that.isCustomControllerHidden_ = false; | 208 // Load was successful; show the custom controller. |
| 209 }, function() { | 209 that.isCustomControllerHidden_ = false; |
| 210 // Load was unsuccessful; fall back to default view. | 210 }, |
| 211 that.isCustomControllerHidden_ = true; | 211 function() { |
| 212 }); | 212 // Load was unsuccessful; fall back to default view. |
| 213 that.isCustomControllerHidden_ = true; |
| 214 }); |
| 213 }, | 215 }, |
| 214 }); | 216 }); |
| OLD | NEW |