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 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 | 159 |
160 /** | 160 /** |
161 * Updates the max height of the dialog | 161 * Updates the max height of the dialog |
162 * | 162 * |
163 * @param {number} height | 163 * @param {number} height |
164 */ | 164 */ |
165 function updateMaxHeight(height) { | 165 function updateMaxHeight(height) { |
166 container.updateMaxDialogHeight(height); | 166 container.updateMaxDialogHeight(height); |
167 } | 167 } |
168 | 168 |
| 169 /** |
| 170 * Updates the route status shown in the details view. |
| 171 * |
| 172 * @param {!media_router.RouteStatus} status |
| 173 */ |
| 174 function updateRouteStatus(status) { |
| 175 container.updateRouteStatus(status); |
| 176 } |
| 177 |
169 return { | 178 return { |
170 onCreateRouteResponseReceived: onCreateRouteResponseReceived, | 179 onCreateRouteResponseReceived: onCreateRouteResponseReceived, |
171 receiveSearchResult: receiveSearchResult, | 180 receiveSearchResult: receiveSearchResult, |
172 setCastModeList: setCastModeList, | 181 setCastModeList: setCastModeList, |
173 setElements: setElements, | 182 setElements: setElements, |
174 setFirstRunFlowData: setFirstRunFlowData, | 183 setFirstRunFlowData: setFirstRunFlowData, |
175 setInitialData: setInitialData, | 184 setInitialData: setInitialData, |
176 setIssue: setIssue, | 185 setIssue: setIssue, |
177 setRouteList: setRouteList, | 186 setRouteList: setRouteList, |
178 setSinkListAndIdentity: setSinkListAndIdentity, | 187 setSinkListAndIdentity: setSinkListAndIdentity, |
179 updateMaxHeight: updateMaxHeight, | 188 updateMaxHeight: updateMaxHeight, |
| 189 updateRouteStatus: updateRouteStatus, |
180 }; | 190 }; |
181 }); | 191 }); |
182 | 192 |
183 // API invoked by this UI to communicate with the browser WebUI message handler. | 193 // API invoked by this UI to communicate with the browser WebUI message handler. |
184 cr.define('media_router.browserApi', function() { | 194 cr.define('media_router.browserApi', function() { |
185 'use strict'; | 195 'use strict'; |
186 | 196 |
187 /** | 197 /** |
188 * Indicates that the user has acknowledged the first run flow. | 198 * Indicates that the user has acknowledged the first run flow. |
189 * | 199 * |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
248 } | 258 } |
249 | 259 |
250 /** | 260 /** |
251 * Indicates that the initial data has been received. | 261 * Indicates that the initial data has been received. |
252 */ | 262 */ |
253 function onInitialDataReceived() { | 263 function onInitialDataReceived() { |
254 chrome.send('onInitialDataReceived'); | 264 chrome.send('onInitialDataReceived'); |
255 } | 265 } |
256 | 266 |
257 /** | 267 /** |
| 268 * Reports that the route details view was closed. |
| 269 */ |
| 270 function onRouteDetailsClosed() { |
| 271 chrome.send('onRouteDetailsClosed'); |
| 272 } |
| 273 |
| 274 /** |
| 275 * Reports that the route details view was opened for |routeId|. |
| 276 * |
| 277 * @param {string} routeId |
| 278 */ |
| 279 function onRouteDetailsOpened(routeId) { |
| 280 chrome.send('onRouteDetailsOpened', [{routeId: routeId}]); |
| 281 } |
| 282 |
| 283 /** |
| 284 * Sends a command to pause the route shown in the route details view. |
| 285 */ |
| 286 function pauseRoute() { |
| 287 chrome.send('pauseRoute'); |
| 288 } |
| 289 |
| 290 /** |
| 291 * Sends a command to play the route shown in the route details view. |
| 292 */ |
| 293 function playRoute() { |
| 294 chrome.send('playRoute'); |
| 295 } |
| 296 |
| 297 /** |
258 * Reports when the user clicks outside the dialog. | 298 * Reports when the user clicks outside the dialog. |
259 */ | 299 */ |
260 function reportBlur() { | 300 function reportBlur() { |
261 chrome.send('reportBlur'); | 301 chrome.send('reportBlur'); |
262 } | 302 } |
263 | 303 |
264 /** | 304 /** |
265 * Reports the index of the selected sink. | 305 * Reports the index of the selected sink. |
266 * | 306 * |
267 * @param {number} sinkIndex | 307 * @param {number} sinkIndex |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
394 */ | 434 */ |
395 function searchSinksAndCreateRoute( | 435 function searchSinksAndCreateRoute( |
396 sinkId, searchCriteria, domain, selectedCastMode) { | 436 sinkId, searchCriteria, domain, selectedCastMode) { |
397 chrome.send('searchSinksAndCreateRoute', | 437 chrome.send('searchSinksAndCreateRoute', |
398 [{sinkId: sinkId, | 438 [{sinkId: sinkId, |
399 searchCriteria: searchCriteria, | 439 searchCriteria: searchCriteria, |
400 domain: domain, | 440 domain: domain, |
401 selectedCastMode: selectedCastMode}]); | 441 selectedCastMode: selectedCastMode}]); |
402 } | 442 } |
403 | 443 |
| 444 /** |
| 445 * Sends a command to seek the route shown in the route details view. |
| 446 * |
| 447 * @param {number} time The new current time in milliseconds. |
| 448 */ |
| 449 function seekRoute(time) { |
| 450 chrome.send('seekRoute', [{time: time}]); |
| 451 } |
| 452 |
| 453 /** |
| 454 * Sends a command to mute or unmute the route shown in the route details |
| 455 * view. |
| 456 * |
| 457 * @param {boolean} mute Mute the route if true, unmute it if false. |
| 458 */ |
| 459 function setRouteMute(mute) { |
| 460 chrome.send('setRouteMute', [{mute: mute}]); |
| 461 } |
| 462 |
| 463 /** |
| 464 * Sends a command to change the volume of the route shown in the route |
| 465 * details view. |
| 466 * |
| 467 * @param {number} volume The volume between 0 and 1. |
| 468 */ |
| 469 function setRouteVolume(volume) { |
| 470 chrome.send('setRouteVolume', [{volume: volume}]); |
| 471 } |
| 472 |
404 return { | 473 return { |
405 acknowledgeFirstRunFlow: acknowledgeFirstRunFlow, | 474 acknowledgeFirstRunFlow: acknowledgeFirstRunFlow, |
406 actOnIssue: actOnIssue, | 475 actOnIssue: actOnIssue, |
407 changeRouteSource: changeRouteSource, | 476 changeRouteSource: changeRouteSource, |
408 closeDialog: closeDialog, | 477 closeDialog: closeDialog, |
409 closeRoute: closeRoute, | 478 closeRoute: closeRoute, |
410 joinRoute: joinRoute, | 479 joinRoute: joinRoute, |
411 onInitialDataReceived: onInitialDataReceived, | 480 onInitialDataReceived: onInitialDataReceived, |
| 481 onRouteDetailsClosed: onRouteDetailsClosed, |
| 482 onRouteDetailsOpened: onRouteDetailsOpened, |
| 483 pauseRoute: pauseRoute, |
| 484 playRoute: playRoute, |
412 reportBlur: reportBlur, | 485 reportBlur: reportBlur, |
413 reportClickedSinkIndex: reportClickedSinkIndex, | 486 reportClickedSinkIndex: reportClickedSinkIndex, |
414 reportFilter: reportFilter, | 487 reportFilter: reportFilter, |
415 reportInitialAction: reportInitialAction, | 488 reportInitialAction: reportInitialAction, |
416 reportInitialState: reportInitialState, | 489 reportInitialState: reportInitialState, |
417 reportNavigateToView: reportNavigateToView, | 490 reportNavigateToView: reportNavigateToView, |
418 reportRouteCreation: reportRouteCreation, | 491 reportRouteCreation: reportRouteCreation, |
419 reportRouteCreationOutcome: reportRouteCreationOutcome, | 492 reportRouteCreationOutcome: reportRouteCreationOutcome, |
420 reportSelectedCastMode: reportSelectedCastMode, | 493 reportSelectedCastMode: reportSelectedCastMode, |
421 reportSinkCount: reportSinkCount, | 494 reportSinkCount: reportSinkCount, |
422 reportTimeToClickSink: reportTimeToClickSink, | 495 reportTimeToClickSink: reportTimeToClickSink, |
423 reportTimeToInitialActionClose: reportTimeToInitialActionClose, | 496 reportTimeToInitialActionClose: reportTimeToInitialActionClose, |
424 requestInitialData: requestInitialData, | 497 requestInitialData: requestInitialData, |
425 requestRoute: requestRoute, | 498 requestRoute: requestRoute, |
426 searchSinksAndCreateRoute: searchSinksAndCreateRoute, | 499 searchSinksAndCreateRoute: searchSinksAndCreateRoute, |
| 500 seekRoute: seekRoute, |
| 501 setRouteMute: setRouteMute, |
| 502 setRouteVolume: setRouteVolume, |
427 }; | 503 }; |
428 }); | 504 }); |
OLD | NEW |