Chromium Code Reviews| 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 // API invoked by the browser MediaRouterWebUIMessageHandler to communicate | 5 // API invoked by the browser MediaRouterWebUIMessageHandler to communicate |
| 6 // with this UI. | 6 // with this UI. |
| 7 cr.define('media_router.ui', function() { | 7 cr.define('media_router.ui', function() { |
| 8 'use strict'; | 8 'use strict'; |
| 9 | 9 |
| 10 // The media-router-container element. | 10 // The media-router-container element. |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 60 * sinks - list of sinks to be displayed. | 60 * sinks - list of sinks to be displayed. |
| 61 * routes - list of routes that are associated with the sinks. | 61 * routes - list of routes that are associated with the sinks. |
| 62 * castModes - list of available cast modes. | 62 * castModes - list of available cast modes. |
| 63 * initialCastModeType - cast mode to show initially. Expected to be | 63 * initialCastModeType - cast mode to show initially. Expected to be |
| 64 * included in |castModes|. | 64 * included in |castModes|. |
| 65 */ | 65 */ |
| 66 function setInitialData(data) { | 66 function setInitialData(data) { |
| 67 container.deviceMissingUrl = data['deviceMissingUrl']; | 67 container.deviceMissingUrl = data['deviceMissingUrl']; |
| 68 container.allSinks = data['sinks']; | 68 container.allSinks = data['sinks']; |
| 69 container.routeList = data['routes']; | 69 container.routeList = data['routes']; |
| 70 container.joinableRouteList = data['joinableRoutes']; | |
| 70 container.initializeCastModes(data['castModes'], | 71 container.initializeCastModes(data['castModes'], |
| 71 data['initialCastModeType']); | 72 data['initialCastModeType']); |
| 72 } | 73 } |
| 73 | 74 |
| 74 /** | 75 /** |
| 75 * Sets current issue to |issue|, or clears the current issue if |issue| is | 76 * Sets current issue to |issue|, or clears the current issue if |issue| is |
| 76 * null. | 77 * null. |
| 77 * | 78 * |
| 78 * @param {?media_router.Issue} issue | 79 * @param {?media_router.Issue} issue |
| 79 */ | 80 */ |
| 80 function setIssue(issue) { | 81 function setIssue(issue) { |
| 81 container.issue = issue; | 82 container.issue = issue; |
| 82 } | 83 } |
| 83 | 84 |
| 84 /** | 85 /** |
| 85 * Sets the list of currently active routes. | 86 * Sets the list of currently active routes. |
| 86 * | 87 * |
| 87 * @param {!Array<!media_router.Route>} routeList | 88 * @param {!Array<!media_router.Route>} routeList |
| 89 * @param {!Array<!media_router.Route>} joinableRouteList | |
| 88 */ | 90 */ |
| 89 function setRouteList(routeList) { | 91 function setRouteList(routeList, joinableRouteList) { |
| 90 container.routeList = routeList; | 92 container.routeList = routeList; |
|
imcheng
2015/11/19 18:55:08
I would prefer an updateRouteList method in |conta
matt.boetger
2015/11/24 19:45:24
Done.
| |
| 93 container.joinableRouteList = joinableRouteList; | |
| 91 } | 94 } |
| 92 | 95 |
| 93 /** | 96 /** |
| 94 * Sets the list of discovered sinks. | 97 * Sets the list of discovered sinks. |
| 95 * | 98 * |
| 96 * @param {!Array<!media_router.Sink>} sinkList | 99 * @param {!Array<!media_router.Sink>} sinkList |
| 97 */ | 100 */ |
| 98 function setSinkList(sinkList) { | 101 function setSinkList(sinkList) { |
| 99 container.allSinks = sinkList; | 102 container.allSinks = sinkList; |
| 100 } | 103 } |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 137 /** | 140 /** |
| 138 * Closes the given route. | 141 * Closes the given route. |
| 139 * | 142 * |
| 140 * @param {!media_router.Route} route | 143 * @param {!media_router.Route} route |
| 141 */ | 144 */ |
| 142 function closeRoute(route) { | 145 function closeRoute(route) { |
| 143 chrome.send('closeRoute', [{routeId: route.id}]); | 146 chrome.send('closeRoute', [{routeId: route.id}]); |
| 144 } | 147 } |
| 145 | 148 |
| 146 /** | 149 /** |
| 150 * Joins the given route. | |
| 151 * | |
| 152 * @param {!media_router.Route} route | |
| 153 */ | |
| 154 function joinRoute(route) { | |
| 155 chrome.send('joinRoute', [{sinkId: route.sinkId, routeId: route.id}]); | |
| 156 } | |
| 157 | |
| 158 /** | |
| 147 * Reports the current number of sinks. | 159 * Reports the current number of sinks. |
| 148 * | 160 * |
| 149 * @param {number} sinkCount | 161 * @param {number} sinkCount |
| 150 */ | 162 */ |
| 151 function reportSinkCount(sinkCount) { | 163 function reportSinkCount(sinkCount) { |
| 152 chrome.send('reportSinkCount', [sinkCount]); | 164 chrome.send('reportSinkCount', [sinkCount]); |
| 153 } | 165 } |
| 154 | 166 |
| 155 /** | 167 /** |
| 156 * Requests data to initialize the WebUI with. | 168 * Requests data to initialize the WebUI with. |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 169 */ | 181 */ |
| 170 function requestRoute(sinkId, selectedCastMode) { | 182 function requestRoute(sinkId, selectedCastMode) { |
| 171 chrome.send('requestRoute', | 183 chrome.send('requestRoute', |
| 172 [{sinkId: sinkId, selectedCastMode: selectedCastMode}]); | 184 [{sinkId: sinkId, selectedCastMode: selectedCastMode}]); |
| 173 } | 185 } |
| 174 | 186 |
| 175 return { | 187 return { |
| 176 actOnIssue: actOnIssue, | 188 actOnIssue: actOnIssue, |
| 177 closeDialog: closeDialog, | 189 closeDialog: closeDialog, |
| 178 closeRoute: closeRoute, | 190 closeRoute: closeRoute, |
| 191 joinRoute: joinRoute, | |
| 179 reportSinkCount: reportSinkCount, | 192 reportSinkCount: reportSinkCount, |
| 180 requestInitialData: requestInitialData, | 193 requestInitialData: requestInitialData, |
| 181 requestRoute: requestRoute, | 194 requestRoute: requestRoute, |
| 182 }; | 195 }; |
| 183 }); | 196 }); |
| OLD | NEW |