| 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: { |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 * Fires a close-route-click event. This is called when the button to close | 53 * Fires a close-route-click event. This is called when the button to close |
| 54 * the current route is clicked. | 54 * the current route is clicked. |
| 55 * | 55 * |
| 56 * @private | 56 * @private |
| 57 */ | 57 */ |
| 58 closeRoute_: function() { | 58 closeRoute_: function() { |
| 59 this.fire('close-route-click', {route: this.route}); | 59 this.fire('close-route-click', {route: this.route}); |
| 60 }, | 60 }, |
| 61 | 61 |
| 62 /** | 62 /** |
| 63 * Fires a start-casting-to-route-click event. This is called when the button | 63 * Fires a start-casting-to-route-click event if the current route is |
| 64 * to start casting to the current route is clicked. | 64 * joinable, otherwise it fires a cast-new-media-click event. This is called |
| 65 * when the button to start casting to the current route is clicked. |
| 65 * | 66 * |
| 66 * @private | 67 * @private |
| 67 */ | 68 */ |
| 68 startCastingToRoute_: function() { | 69 startCastingToRoute_: function() { |
| 69 this.fire('start-casting-to-route-click', {route: this.route}); | 70 if (this.route.canJoin) { |
| 71 this.fire('start-casting-to-route-click', {route: this.route}); |
| 72 } else { |
| 73 this.fire('cast-new-media-click', {route: this.route}); |
| 74 } |
| 70 }, | 75 }, |
| 71 | 76 |
| 72 /** | 77 /** |
| 73 * Loads the custom controller if |route.customControllerPath| exists. | 78 * Loads the custom controller if |route.customControllerPath| exists. |
| 74 * Falls back to the default route details view otherwise, or if load fails. | 79 * Falls back to the default route details view otherwise, or if load fails. |
| 75 * Updates |activityStatus_| for the default view. | 80 * Updates |activityStatus_| for the default view. |
| 76 * | 81 * |
| 77 * @private | 82 * @private |
| 78 */ | 83 */ |
| 79 maybeLoadCustomController_: function() { | 84 maybeLoadCustomController_: function() { |
| (...skipping 20 matching lines...) Expand all Loading... |
| 100 extensionview.load(this.route.customControllerPath) | 105 extensionview.load(this.route.customControllerPath) |
| 101 .then(function() { | 106 .then(function() { |
| 102 // Load was successful; show the custom controller. | 107 // Load was successful; show the custom controller. |
| 103 that.isCustomControllerHidden_ = false; | 108 that.isCustomControllerHidden_ = false; |
| 104 }, function() { | 109 }, function() { |
| 105 // Load was unsuccessful; fall back to default view. | 110 // Load was unsuccessful; fall back to default view. |
| 106 that.isCustomControllerHidden_ = true; | 111 that.isCustomControllerHidden_ = true; |
| 107 }); | 112 }); |
| 108 }, | 113 }, |
| 109 }); | 114 }); |
| OLD | NEW |