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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 * deviceMissingUrl - url to be opened on "Device missing?" clicked. | 58 * deviceMissingUrl - url to be opened on "Device missing?" clicked. |
59 * sinks - list of sinks to be displayed. | 59 * sinks - list of sinks to be displayed. |
60 * routes - list of routes that are associated with the sinks. | 60 * routes - list of routes that are associated with the sinks. |
61 * castModes - list of available cast modes. | 61 * castModes - list of available cast modes. |
62 */ | 62 */ |
63 function setInitialData(data) { | 63 function setInitialData(data) { |
64 container.deviceMissingUrl = data['deviceMissingUrl']; | 64 container.deviceMissingUrl = data['deviceMissingUrl']; |
65 container.castModeList = data['castModes']; | 65 container.castModeList = data['castModes']; |
66 container.allSinks = data['sinks']; | 66 container.allSinks = data['sinks']; |
67 container.routeList = data['routes']; | 67 container.routeList = data['routes']; |
| 68 media_router.browserApi.onInitialDataReceived(); |
68 } | 69 } |
69 | 70 |
70 /** | 71 /** |
71 * Sets current issue to |issue|, or clears the current issue if |issue| is | 72 * Sets current issue to |issue|, or clears the current issue if |issue| is |
72 * null. | 73 * null. |
73 * | 74 * |
74 * @param {?media_router.Issue} issue | 75 * @param {?media_router.Issue} issue |
75 */ | 76 */ |
76 function setIssue(issue) { | 77 function setIssue(issue) { |
77 container.issue = issue; | 78 container.issue = issue; |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 /** | 134 /** |
134 * Closes the given route. | 135 * Closes the given route. |
135 * | 136 * |
136 * @param {!media_router.Route} route | 137 * @param {!media_router.Route} route |
137 */ | 138 */ |
138 function closeRoute(route) { | 139 function closeRoute(route) { |
139 chrome.send('closeRoute', [{routeId: route.id}]); | 140 chrome.send('closeRoute', [{routeId: route.id}]); |
140 } | 141 } |
141 | 142 |
142 /** | 143 /** |
| 144 * Indicates that the initial data has been received. |
| 145 */ |
| 146 function onInitialDataReceived() { |
| 147 chrome.send('onInitialDataReceived'); |
| 148 } |
| 149 |
| 150 /** |
143 * Reports the current number of sinks. | 151 * Reports the current number of sinks. |
144 * | 152 * |
145 * @param {number} sinkCount | 153 * @param {number} sinkCount |
146 */ | 154 */ |
147 function reportSinkCount(sinkCount) { | 155 function reportSinkCount(sinkCount) { |
148 chrome.send('reportSinkCount', [sinkCount]); | 156 chrome.send('reportSinkCount', [sinkCount]); |
149 } | 157 } |
150 | 158 |
151 /** | 159 /** |
152 * Requests data to initialize the WebUI with. | 160 * Requests data to initialize the WebUI with. |
(...skipping 12 matching lines...) Expand all Loading... |
165 */ | 173 */ |
166 function requestRoute(sinkId, selectedCastMode) { | 174 function requestRoute(sinkId, selectedCastMode) { |
167 chrome.send('requestRoute', | 175 chrome.send('requestRoute', |
168 [{sinkId: sinkId, selectedCastMode: selectedCastMode}]); | 176 [{sinkId: sinkId, selectedCastMode: selectedCastMode}]); |
169 } | 177 } |
170 | 178 |
171 return { | 179 return { |
172 actOnIssue: actOnIssue, | 180 actOnIssue: actOnIssue, |
173 closeDialog: closeDialog, | 181 closeDialog: closeDialog, |
174 closeRoute: closeRoute, | 182 closeRoute: closeRoute, |
| 183 onInitialDataReceived: onInitialDataReceived, |
175 reportSinkCount: reportSinkCount, | 184 reportSinkCount: reportSinkCount, |
176 requestInitialData: requestInitialData, | 185 requestInitialData: requestInitialData, |
177 requestRoute: requestRoute, | 186 requestRoute: requestRoute, |
178 }; | 187 }; |
179 }); | 188 }); |
OLD | NEW |