| 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 * Whether the browser is currently incognito. |
| 22 * @type {boolean} |
| 23 */ |
| 24 isOffTheRecord: { |
| 25 type: Boolean, |
| 26 value: false, |
| 27 }, |
| 28 |
| 29 /** |
| 21 * The route to show. | 30 * The route to show. |
| 22 * @type {?media_router.Route} | 31 * @type {?media_router.Route} |
| 23 */ | 32 */ |
| 24 route: { | 33 route: { |
| 25 type: Object, | 34 type: Object, |
| 26 value: null, | 35 value: null, |
| 27 observer: 'maybeLoadCustomController_', | 36 observer: 'maybeLoadCustomController_', |
| 28 }, | 37 }, |
| 29 | 38 |
| 30 /** | 39 /** |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 * Updates |activityStatus_| for the default view. | 94 * Updates |activityStatus_| for the default view. |
| 86 * | 95 * |
| 87 * @private | 96 * @private |
| 88 */ | 97 */ |
| 89 maybeLoadCustomController_: function() { | 98 maybeLoadCustomController_: function() { |
| 90 this.activityStatus_ = this.route ? | 99 this.activityStatus_ = this.route ? |
| 91 loadTimeData.getStringF('castingActivityStatus', | 100 loadTimeData.getStringF('castingActivityStatus', |
| 92 this.route.description) : | 101 this.route.description) : |
| 93 ''; | 102 ''; |
| 94 | 103 |
| 95 if (!this.route || !this.route.customControllerPath) { | 104 if (!this.route || !this.route.customControllerPath || |
| 105 this.isOffTheRecord) { |
| 96 this.isCustomControllerHidden_ = true; | 106 this.isCustomControllerHidden_ = true; |
| 97 return; | 107 return; |
| 98 } | 108 } |
| 99 | 109 |
| 100 // Show custom controller | 110 // Show custom controller |
| 101 var extensionview = this.$['custom-controller']; | 111 var extensionview = this.$['custom-controller']; |
| 102 | 112 |
| 103 // Do nothing if the url is the same and the view is not hidden. | 113 // Do nothing if the url is the same and the view is not hidden. |
| 104 if (this.route.customControllerPath == extensionview.src && | 114 if (this.route.customControllerPath == extensionview.src && |
| 105 !this.isCustomControllerHidden_) | 115 !this.isCustomControllerHidden_) |
| 106 return; | 116 return; |
| 107 | 117 |
| 108 var that = this; | 118 var that = this; |
| 109 extensionview.load(this.route.customControllerPath) | 119 extensionview.load(this.route.customControllerPath) |
| 110 .then(function() { | 120 .then(function() { |
| 111 // Load was successful; show the custom controller. | 121 // Load was successful; show the custom controller. |
| 112 that.isCustomControllerHidden_ = false; | 122 that.isCustomControllerHidden_ = false; |
| 113 }, function() { | 123 }, function() { |
| 114 // Load was unsuccessful; fall back to default view. | 124 // Load was unsuccessful; fall back to default view. |
| 115 that.isCustomControllerHidden_ = true; | 125 that.isCustomControllerHidden_ = true; |
| 116 }); | 126 }); |
| 117 }, | 127 }, |
| 118 }); | 128 }); |
| OLD | NEW |