| 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} | 13 * @private {string} |
| 14 */ | 14 */ |
| 15 activityStatus_: { | 15 activityStatus_: { |
| 16 type: String, | 16 type: String, |
| 17 value: '', | 17 value: '', |
| 18 }, | 18 }, |
| 19 | 19 |
| 20 /** | 20 /** |
| 21 * The localized strings used by |this|. | |
| 22 * @private {!Object} | |
| 23 */ | |
| 24 i18n_: { | |
| 25 readOnly: true, | |
| 26 type: Object, | |
| 27 value: function() { | |
| 28 var strings = {}; | |
| 29 [ | |
| 30 'startCastingButtonText', | |
| 31 'stopCastingButtonText', | |
| 32 'dropDownButtonTitle', | |
| 33 ] | |
| 34 .forEach(function(s) { | |
| 35 strings[s] = loadTimeData.getString(s); | |
| 36 }); | |
| 37 return strings; | |
| 38 }, | |
| 39 }, | |
| 40 | |
| 41 /** | |
| 42 * The route to show. | 21 * The route to show. |
| 43 * @type {?media_router.Route} | 22 * @type {?media_router.Route} |
| 44 */ | 23 */ |
| 45 route: { | 24 route: { |
| 46 type: Object, | 25 type: Object, |
| 47 value: null, | 26 value: null, |
| 48 observer: 'maybeLoadCustomController_', | 27 observer: 'maybeLoadCustomController_', |
| 49 }, | 28 }, |
| 50 | 29 |
| 51 /** | 30 /** |
| 52 * Whether the custom controller should be hidden. | 31 * Whether the custom controller should be hidden. |
| 53 * A custom controller is shown iff |route| specifies customControllerPath | 32 * A custom controller is shown iff |route| specifies customControllerPath |
| 54 * and the view can be loaded. | 33 * and the view can be loaded. |
| 55 * @private {boolean} | 34 * @private {boolean} |
| 56 */ | 35 */ |
| 57 isCustomControllerHidden_: { | 36 isCustomControllerHidden_: { |
| 58 type: Boolean, | 37 type: Boolean, |
| 59 value: true, | 38 value: true, |
| 60 }, | 39 }, |
| 61 }, | 40 }, |
| 62 | 41 |
| 42 behaviors: [ |
| 43 I18nBehavior, |
| 44 ], |
| 45 |
| 63 /** | 46 /** |
| 64 * Fires a close-route-click event. This is called when the button to close | 47 * Fires a close-route-click event. This is called when the button to close |
| 65 * the current route is clicked. | 48 * the current route is clicked. |
| 66 * | 49 * |
| 67 * @private | 50 * @private |
| 68 */ | 51 */ |
| 69 closeRoute_: function() { | 52 closeRoute_: function() { |
| 70 this.fire('close-route-click', {route: this.route}); | 53 this.fire('close-route-click', {route: this.route}); |
| 71 }, | 54 }, |
| 72 | 55 |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 extensionview.load(this.route.customControllerPath) | 93 extensionview.load(this.route.customControllerPath) |
| 111 .then(function() { | 94 .then(function() { |
| 112 // Load was successful; show the custom controller. | 95 // Load was successful; show the custom controller. |
| 113 that.isCustomControllerHidden_ = false; | 96 that.isCustomControllerHidden_ = false; |
| 114 }, function() { | 97 }, function() { |
| 115 // Load was unsuccessful; fall back to default view. | 98 // Load was unsuccessful; fall back to default view. |
| 116 that.isCustomControllerHidden_ = true; | 99 that.isCustomControllerHidden_ = true; |
| 117 }); | 100 }); |
| 118 }, | 101 }, |
| 119 }); | 102 }); |
| OLD | NEW |