| 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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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.initializeCastModes(data['castModes'], | 70 container.initializeCastModes(data['castModes'], |
| 71 data['initialCastModeType']); | 71 data['initialCastModeType']); |
| 72 media_router.browserApi.onInitialDataReceived(); |
| 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; |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 /** | 138 /** |
| 138 * Closes the given route. | 139 * Closes the given route. |
| 139 * | 140 * |
| 140 * @param {!media_router.Route} route | 141 * @param {!media_router.Route} route |
| 141 */ | 142 */ |
| 142 function closeRoute(route) { | 143 function closeRoute(route) { |
| 143 chrome.send('closeRoute', [{routeId: route.id}]); | 144 chrome.send('closeRoute', [{routeId: route.id}]); |
| 144 } | 145 } |
| 145 | 146 |
| 146 /** | 147 /** |
| 148 * Indicates that the initial data has been received. |
| 149 */ |
| 150 function onInitialDataReceived() { |
| 151 chrome.send('onInitialDataReceived'); |
| 152 } |
| 153 |
| 154 /** |
| 147 * Reports the current number of sinks. | 155 * Reports the current number of sinks. |
| 148 * | 156 * |
| 149 * @param {number} sinkCount | 157 * @param {number} sinkCount |
| 150 */ | 158 */ |
| 151 function reportSinkCount(sinkCount) { | 159 function reportSinkCount(sinkCount) { |
| 152 chrome.send('reportSinkCount', [sinkCount]); | 160 chrome.send('reportSinkCount', [sinkCount]); |
| 153 } | 161 } |
| 154 | 162 |
| 155 /** | 163 /** |
| 156 * Requests data to initialize the WebUI with. | 164 * Requests data to initialize the WebUI with. |
| (...skipping 12 matching lines...) Expand all Loading... |
| 169 */ | 177 */ |
| 170 function requestRoute(sinkId, selectedCastMode) { | 178 function requestRoute(sinkId, selectedCastMode) { |
| 171 chrome.send('requestRoute', | 179 chrome.send('requestRoute', |
| 172 [{sinkId: sinkId, selectedCastMode: selectedCastMode}]); | 180 [{sinkId: sinkId, selectedCastMode: selectedCastMode}]); |
| 173 } | 181 } |
| 174 | 182 |
| 175 return { | 183 return { |
| 176 actOnIssue: actOnIssue, | 184 actOnIssue: actOnIssue, |
| 177 closeDialog: closeDialog, | 185 closeDialog: closeDialog, |
| 178 closeRoute: closeRoute, | 186 closeRoute: closeRoute, |
| 187 onInitialDataReceived: onInitialDataReceived, |
| 179 reportSinkCount: reportSinkCount, | 188 reportSinkCount: reportSinkCount, |
| 180 requestInitialData: requestInitialData, | 189 requestInitialData: requestInitialData, |
| 181 requestRoute: requestRoute, | 190 requestRoute: requestRoute, |
| 182 }; | 191 }; |
| 183 }); | 192 }); |
| OLD | NEW |