Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(238)

Side by Side Diff: chrome/browser/resources/media_router/elements/route_details/route_details.js

Issue 1415103006: Non-Local Join for Media Router and Presentation API (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removing Logging Statements Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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. It is assumed that |route| and |sink| correspond to each other. 6 // to a device. It is assumed that |route| and |sink| correspond to each other.
7 Polymer({ 7 Polymer({
8 is: 'route-details', 8 is: 'route-details',
9 9
10 properties: { 10 properties: {
(...skipping 29 matching lines...) Expand all
40 /** 40 /**
41 * The sink to show. 41 * The sink to show.
42 * @type {?media_router.Sink} 42 * @type {?media_router.Sink}
43 */ 43 */
44 sink: { 44 sink: {
45 type: Object, 45 type: Object,
46 value: null, 46 value: null,
47 }, 47 },
48 48
49 /** 49 /**
50 * The text for the join casting button.
51 * @private {string}
52 */
53 joinCastingButtonText_: {
54 type: String,
55 value: loadTimeData.getString('joinCastingButton'),
56 },
57
58 /**
50 * The text for the stop casting button. 59 * The text for the stop casting button.
51 * @private {string} 60 * @private {string}
52 */ 61 */
53 stopCastingButtonText_: { 62 stopCastingButtonText_: {
54 type: String, 63 type: String,
55 readOnly: true, 64 readOnly: true,
56 value: loadTimeData.getString('stopCastingButton'), 65 value: loadTimeData.getString('stopCastingButton'),
57 }, 66 },
58 67
59 /** 68 /**
60 * Whether the custom controller should be hidden. 69 * Whether the custom controller should be hidden.
61 * A custom controller is shown iff |route| specifies customControllerPath 70 * A custom controller is shown iff |route| specifies customControllerPath
62 * and the view can be loaded. 71 * and the view can be loaded.
63 * @private {boolean} 72 * @private {boolean}
64 */ 73 */
65 isCustomControllerHidden_: { 74 isCustomControllerHidden_: {
66 type: Boolean, 75 type: Boolean,
67 value: true, 76 value: true,
68 }, 77 },
78
79 /**
80 * Whether the join button is hidden.
81 * The join button is shown iff |route| specifies customControllerPath
82 * and the view can be loaded.
83 * @private {boolean}
84 */
85 canJoin: {type: Boolean, value: true},
69 }, 86 },
70 87
71 /** 88 /**
89 * Fires a join-route-click event. This is called when the button to
90 * the current route is clicked.
91 *
92 * @private
93 */
94 joinRoute_: function() {
95 this.fire('join-route-click', {route: this.route});
96 },
97
98 /**
72 * Fires a close-route-click event. This is called when the button to close 99 * Fires a close-route-click event. This is called when the button to close
73 * the current route is clicked. 100 * the current route is clicked.
74 * 101 *
75 * @private 102 * @private
76 */ 103 */
77 closeRoute_: function() { 104 closeRoute_: function() {
78 this.fire('close-route-click', {route: this.route}); 105 this.fire('close-route-click', {route: this.route});
79 }, 106 },
80 107
81 /** 108 /**
82 * Loads the custom controller if |route.customControllerPath| exists. 109 * Loads the custom controller if |route.customControllerPath| exists.
83 * Falls back to the default route details view otherwise, or if load fails. 110 * Falls back to the default route details view otherwise, or if load fails.
84 * Updates |activityStatus_| for the default view. 111 * Updates |activityStatus_| for the default view.
85 * 112 *
86 * @private 113 * @private
87 */ 114 */
88 maybeLoadCustomController_: function() { 115 maybeLoadCustomController_: function() {
89 this.activityStatus_ = this.route ? 116 this.activityStatus_ =
90 loadTimeData.getStringF('castingActivityStatus', 117 this.route ?
91 this.route.description) : 118 loadTimeData.getStringF(
92 ''; 119 'castingActivityStatus', this.route.description) :
120 '';
93 121
94 if (!this.route || !this.route.customControllerPath) { 122 if (!this.route || !this.route.customControllerPath) {
95 this.isCustomControllerHidden_ = true; 123 this.isCustomControllerHidden_ = true;
96 return; 124 return;
97 } 125 }
98 126
99 // Show custom controller 127 // Show custom controller
100 var extensionview = this.$['custom-controller']; 128 var extensionview = this.$['custom-controller'];
101 129
102 // Do nothing if the url is the same and the view is not hidden. 130 // Do nothing if the url is the same and the view is not hidden.
103 if (this.route.customControllerPath == extensionview.src && 131 if (this.route.customControllerPath == extensionview.src &&
104 !this.isCustomControllerHidden_) 132 !this.isCustomControllerHidden_)
105 return; 133 return;
106 134
107 var that = this; 135 var that = this;
108 extensionview.load(this.route.customControllerPath) 136 extensionview.load(this.route.customControllerPath)
109 .then(function() { 137 .then(
110 // Load was successful; show the custom controller. 138 function() {
111 that.isCustomControllerHidden_ = false; 139 // Load was successful; show the custom controller.
112 }, function() { 140 that.isCustomControllerHidden_ = false;
113 // Load was unsuccessful; fall back to default view. 141 },
114 that.isCustomControllerHidden_ = true; 142 function() {
115 }); 143 // Load was unsuccessful; fall back to default view.
144 that.isCustomControllerHidden_ = true;
145 });
116 }, 146 },
117 }); 147 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698