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. |
| 11 var container = null; | 11 var container = null; |
| 12 | 12 |
| 13 // The media-router-header element. | 13 // The media-router-header element. |
| 14 var header = null; | 14 var header = null; |
| 15 | 15 |
| 16 /** | 16 /** |
| 17 * Handles response of previous create route attempt. | 17 * Handles response of previous create route attempt. |
| 18 * | 18 * |
| 19 * @param {string} sinkId The ID of the sink to which the Media Route was | 19 * @param {string} sinkId The ID of the sink to which the Media Route was |
| 20 * creating a route. | 20 * creating a route. |
| 21 * @param {?media_router.Route} route The newly created route that | 21 * @param {?media_router.Route} route The newly created route that |
| 22 * corresponds to the sink if route creation succeeded; null otherwise. | 22 * corresponds to the sink if route creation succeeded; null otherwise. |
| 23 * @param {boolean} isForDisplay Whether or not |route| is for display. | 23 * @param {boolean} isForDisplay Whether or not |route| is for display. |
| 24 */ | 24 */ |
| 25 function onCreateRouteResponseReceived(sinkId, route, isForDisplay) { | 25 function onCreateRouteResponseReceived(sinkId, route, isForDisplay) { |
| 26 container.onCreateRouteResponseReceived(sinkId, route, isForDisplay); | 26 container.onCreateRouteResponseReceived(sinkId, route, isForDisplay); |
| 27 } | 27 } |
| 28 | 28 |
| 29 /** | 29 /** |
| 30 * Handles the search response by forwarding |sinkId| to the container. | |
| 31 * | |
| 32 * @param {string} sinkId The ID of the sink found by search. | |
| 33 */ | |
| 34 function receiveSearchResult(sinkId) { | |
| 35 container.onReceiveSearchResult(sinkId); | |
| 36 } | |
| 37 | |
| 38 /** | |
| 30 * Sets the cast mode list. | 39 * Sets the cast mode list. |
| 31 * | 40 * |
| 32 * @param {!Array<!media_router.CastMode>} castModeList | 41 * @param {!Array<!media_router.CastMode>} castModeList |
| 33 */ | 42 */ |
| 34 function setCastModeList(castModeList) { | 43 function setCastModeList(castModeList) { |
| 35 container.castModeList = castModeList; | 44 container.castModeList = castModeList; |
| 36 } | 45 } |
| 37 | 46 |
| 38 /** | 47 /** |
| 39 * Sets |container| and |header|. | 48 * Sets |container| and |header|. |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 152 * Updates the max height of the dialog | 161 * Updates the max height of the dialog |
| 153 * | 162 * |
| 154 * @param {number} height | 163 * @param {number} height |
| 155 */ | 164 */ |
| 156 function updateMaxHeight(height) { | 165 function updateMaxHeight(height) { |
| 157 container.updateMaxDialogHeight(height); | 166 container.updateMaxDialogHeight(height); |
| 158 } | 167 } |
| 159 | 168 |
| 160 return { | 169 return { |
| 161 onCreateRouteResponseReceived: onCreateRouteResponseReceived, | 170 onCreateRouteResponseReceived: onCreateRouteResponseReceived, |
| 171 receiveSearchResult: receiveSearchResult, | |
| 162 setCastModeList: setCastModeList, | 172 setCastModeList: setCastModeList, |
| 163 setElements: setElements, | 173 setElements: setElements, |
| 164 setFirstRunFlowData: setFirstRunFlowData, | 174 setFirstRunFlowData: setFirstRunFlowData, |
| 165 setInitialData: setInitialData, | 175 setInitialData: setInitialData, |
| 166 setIssue: setIssue, | 176 setIssue: setIssue, |
| 167 setRouteList: setRouteList, | 177 setRouteList: setRouteList, |
| 168 setSinkListAndIdentity: setSinkListAndIdentity, | 178 setSinkListAndIdentity: setSinkListAndIdentity, |
| 169 updateMaxHeight: updateMaxHeight, | 179 updateMaxHeight: updateMaxHeight, |
| 170 }; | 180 }; |
| 171 }); | 181 }); |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 350 * | 360 * |
| 351 * @param {string} sinkId The sink ID. | 361 * @param {string} sinkId The sink ID. |
| 352 * @param {number} selectedCastMode The value of the cast mode the user | 362 * @param {number} selectedCastMode The value of the cast mode the user |
| 353 * selected. | 363 * selected. |
| 354 */ | 364 */ |
| 355 function requestRoute(sinkId, selectedCastMode) { | 365 function requestRoute(sinkId, selectedCastMode) { |
| 356 chrome.send('requestRoute', | 366 chrome.send('requestRoute', |
| 357 [{sinkId: sinkId, selectedCastMode: selectedCastMode}]); | 367 [{sinkId: sinkId, selectedCastMode: selectedCastMode}]); |
| 358 } | 368 } |
| 359 | 369 |
| 370 /** | |
| 371 * Requests that the media router search all providers for a sink matching | |
| 372 * |searchCriteria| that can be used with the media source associated with the | |
| 373 * cast mode |selectedCastMode|. If such a sink is found, a route is also | |
| 374 * created between the sink and the media source. | |
| 375 * | |
| 376 * @param {string} sinkId Sink ID of the pseudo sink generating the request. | |
| 377 * @param {string} searchCriteria Search criteria for the route providers. | |
| 378 * @param {string} domain User's current domain. | |
|
apacible
2016/04/06 21:27:02
Is this the user's current domain, or the pseudosi
apacible
2016/04/06 21:27:02
Are pseudosinks guaranteed to have a domain specif
btolsch
2016/04/08 09:31:25
The pseudo-sink will only have a domain if the MRP
| |
| 379 * @param {number} selectedCastMode The value of the cast mode to be used with | |
| 380 * the sink. | |
| 381 */ | |
| 382 function searchSinksAndCreateRoute( | |
| 383 sinkId, searchCriteria, domain, selectedCastMode) { | |
| 384 chrome.send('searchSinksAndCreateRoute', | |
| 385 [{sinkId: sinkId, | |
| 386 searchCriteria: searchCriteria, | |
| 387 domain: domain, | |
| 388 selectedCastMode: selectedCastMode}]); | |
| 389 } | |
| 390 | |
| 360 return { | 391 return { |
| 361 acknowledgeFirstRunFlow: acknowledgeFirstRunFlow, | 392 acknowledgeFirstRunFlow: acknowledgeFirstRunFlow, |
| 362 actOnIssue: actOnIssue, | 393 actOnIssue: actOnIssue, |
| 363 closeDialog: closeDialog, | 394 closeDialog: closeDialog, |
| 364 closeRoute: closeRoute, | 395 closeRoute: closeRoute, |
| 365 joinRoute: joinRoute, | 396 joinRoute: joinRoute, |
| 366 onInitialDataReceived: onInitialDataReceived, | 397 onInitialDataReceived: onInitialDataReceived, |
| 367 reportBlur: reportBlur, | 398 reportBlur: reportBlur, |
| 368 reportClickedSinkIndex: reportClickedSinkIndex, | 399 reportClickedSinkIndex: reportClickedSinkIndex, |
| 369 reportFilter: reportFilter, | 400 reportFilter: reportFilter, |
| 370 reportInitialAction: reportInitialAction, | 401 reportInitialAction: reportInitialAction, |
| 371 reportInitialState: reportInitialState, | 402 reportInitialState: reportInitialState, |
| 372 reportNavigateToView: reportNavigateToView, | 403 reportNavigateToView: reportNavigateToView, |
| 373 reportRouteCreation: reportRouteCreation, | 404 reportRouteCreation: reportRouteCreation, |
| 374 reportRouteCreationOutcome: reportRouteCreationOutcome, | 405 reportRouteCreationOutcome: reportRouteCreationOutcome, |
| 375 reportSelectedCastMode: reportSelectedCastMode, | 406 reportSelectedCastMode: reportSelectedCastMode, |
| 376 reportSinkCount: reportSinkCount, | 407 reportSinkCount: reportSinkCount, |
| 377 reportTimeToClickSink: reportTimeToClickSink, | 408 reportTimeToClickSink: reportTimeToClickSink, |
| 378 reportTimeToInitialActionClose: reportTimeToInitialActionClose, | 409 reportTimeToInitialActionClose: reportTimeToInitialActionClose, |
| 379 requestInitialData: requestInitialData, | 410 requestInitialData: requestInitialData, |
| 380 requestRoute: requestRoute, | 411 requestRoute: requestRoute, |
| 412 searchSinksAndCreateRoute: searchSinksAndCreateRoute, | |
| 381 }; | 413 }; |
| 382 }); | 414 }); |
| OLD | NEW |