| 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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 * Updates |activityStatus_| for the default view. | 78 * Updates |activityStatus_| for the default view. |
| 70 * | 79 * |
| 71 * @private | 80 * @private |
| 72 */ | 81 */ |
| 73 maybeLoadCustomController_: function() { | 82 maybeLoadCustomController_: function() { |
| 74 this.activityStatus_ = this.route ? | 83 this.activityStatus_ = this.route ? |
| 75 loadTimeData.getStringF('castingActivityStatus', | 84 loadTimeData.getStringF('castingActivityStatus', |
| 76 this.route.description) : | 85 this.route.description) : |
| 77 ''; | 86 ''; |
| 78 | 87 |
| 79 if (!this.route || !this.route.customControllerPath) { | 88 if (!this.route || !this.route.customControllerPath || |
| 89 this.isOffTheRecord) { |
| 80 this.isCustomControllerHidden_ = true; | 90 this.isCustomControllerHidden_ = true; |
| 81 return; | 91 return; |
| 82 } | 92 } |
| 83 | 93 |
| 84 // Show custom controller | 94 // Show custom controller |
| 85 var extensionview = this.$['custom-controller']; | 95 var extensionview = this.$['custom-controller']; |
| 86 | 96 |
| 87 // Do nothing if the url is the same and the view is not hidden. | 97 // Do nothing if the url is the same and the view is not hidden. |
| 88 if (this.route.customControllerPath == extensionview.src && | 98 if (this.route.customControllerPath == extensionview.src && |
| 89 !this.isCustomControllerHidden_) | 99 !this.isCustomControllerHidden_) |
| 90 return; | 100 return; |
| 91 | 101 |
| 92 var that = this; | 102 var that = this; |
| 93 extensionview.load(this.route.customControllerPath) | 103 extensionview.load(this.route.customControllerPath) |
| 94 .then(function() { | 104 .then(function() { |
| 95 // Load was successful; show the custom controller. | 105 // Load was successful; show the custom controller. |
| 96 that.isCustomControllerHidden_ = false; | 106 that.isCustomControllerHidden_ = false; |
| 97 }, function() { | 107 }, function() { |
| 98 // Load was unsuccessful; fall back to default view. | 108 // Load was unsuccessful; fall back to default view. |
| 99 that.isCustomControllerHidden_ = true; | 109 that.isCustomControllerHidden_ = true; |
| 100 }); | 110 }); |
| 101 }, | 111 }, |
| 102 }); | 112 }); |
| OLD | NEW |