| 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 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 * Updates the max height of the dialog | 157 * Updates the max height of the dialog |
| 149 * | 158 * |
| 150 * @param {number} height | 159 * @param {number} height |
| 151 */ | 160 */ |
| 152 function updateMaxHeight(height) { | 161 function updateMaxHeight(height) { |
| 153 container.updateMaxDialogHeight(height); | 162 container.updateMaxDialogHeight(height); |
| 154 } | 163 } |
| 155 | 164 |
| 156 return { | 165 return { |
| 157 onCreateRouteResponseReceived: onCreateRouteResponseReceived, | 166 onCreateRouteResponseReceived: onCreateRouteResponseReceived, |
| 167 receiveSearchResult: receiveSearchResult, |
| 158 setCastModeList: setCastModeList, | 168 setCastModeList: setCastModeList, |
| 159 setElements: setElements, | 169 setElements: setElements, |
| 160 setFirstRunFlowData: setFirstRunFlowData, | 170 setFirstRunFlowData: setFirstRunFlowData, |
| 161 setInitialData: setInitialData, | 171 setInitialData: setInitialData, |
| 162 setIssue: setIssue, | 172 setIssue: setIssue, |
| 163 setRouteList: setRouteList, | 173 setRouteList: setRouteList, |
| 164 setSinkListAndIdentity: setSinkListAndIdentity, | 174 setSinkListAndIdentity: setSinkListAndIdentity, |
| 165 updateMaxHeight: updateMaxHeight, | 175 updateMaxHeight: updateMaxHeight, |
| 166 }; | 176 }; |
| 167 }); | 177 }); |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 346 * | 356 * |
| 347 * @param {string} sinkId The sink ID. | 357 * @param {string} sinkId The sink ID. |
| 348 * @param {number} selectedCastMode The value of the cast mode the user | 358 * @param {number} selectedCastMode The value of the cast mode the user |
| 349 * selected. | 359 * selected. |
| 350 */ | 360 */ |
| 351 function requestRoute(sinkId, selectedCastMode) { | 361 function requestRoute(sinkId, selectedCastMode) { |
| 352 chrome.send('requestRoute', | 362 chrome.send('requestRoute', |
| 353 [{sinkId: sinkId, selectedCastMode: selectedCastMode}]); | 363 [{sinkId: sinkId, selectedCastMode: selectedCastMode}]); |
| 354 } | 364 } |
| 355 | 365 |
| 366 /** |
| 367 * Requests that the media router search all providers for a sink matching |
| 368 * |searchCriteria| that can be used with the media source associated with the |
| 369 * cast mode |selectedCastMode|. If such a sink is found, a route is also |
| 370 * created between the sink and the media source. |
| 371 * |
| 372 * @param {string} sinkId Sink ID of the pseudo sink generating the request. |
| 373 * @param {string} searchCriteria Search criteria for the route providers. |
| 374 * @param {string} domain User's current hosted domain. |
| 375 * @param {number} selectedCastMode The value of the cast mode to be used with |
| 376 * the sink. |
| 377 */ |
| 378 function searchSinksAndCreateRoute( |
| 379 sinkId, searchCriteria, domain, selectedCastMode) { |
| 380 chrome.send('searchSinksAndCreateRoute', |
| 381 [{sinkId: sinkId, |
| 382 searchCriteria: searchCriteria, |
| 383 domain: domain, |
| 384 selectedCastMode: selectedCastMode}]); |
| 385 } |
| 386 |
| 356 return { | 387 return { |
| 357 acknowledgeFirstRunFlow: acknowledgeFirstRunFlow, | 388 acknowledgeFirstRunFlow: acknowledgeFirstRunFlow, |
| 358 actOnIssue: actOnIssue, | 389 actOnIssue: actOnIssue, |
| 359 closeDialog: closeDialog, | 390 closeDialog: closeDialog, |
| 360 closeRoute: closeRoute, | 391 closeRoute: closeRoute, |
| 361 joinRoute: joinRoute, | 392 joinRoute: joinRoute, |
| 362 onInitialDataReceived: onInitialDataReceived, | 393 onInitialDataReceived: onInitialDataReceived, |
| 363 reportBlur: reportBlur, | 394 reportBlur: reportBlur, |
| 364 reportClickedSinkIndex: reportClickedSinkIndex, | 395 reportClickedSinkIndex: reportClickedSinkIndex, |
| 365 reportFilter: reportFilter, | 396 reportFilter: reportFilter, |
| 366 reportInitialAction: reportInitialAction, | 397 reportInitialAction: reportInitialAction, |
| 367 reportInitialState: reportInitialState, | 398 reportInitialState: reportInitialState, |
| 368 reportNavigateToView: reportNavigateToView, | 399 reportNavigateToView: reportNavigateToView, |
| 369 reportRouteCreation: reportRouteCreation, | 400 reportRouteCreation: reportRouteCreation, |
| 370 reportRouteCreationOutcome: reportRouteCreationOutcome, | 401 reportRouteCreationOutcome: reportRouteCreationOutcome, |
| 371 reportSelectedCastMode: reportSelectedCastMode, | 402 reportSelectedCastMode: reportSelectedCastMode, |
| 372 reportSinkCount: reportSinkCount, | 403 reportSinkCount: reportSinkCount, |
| 373 reportTimeToClickSink: reportTimeToClickSink, | 404 reportTimeToClickSink: reportTimeToClickSink, |
| 374 reportTimeToInitialActionClose: reportTimeToInitialActionClose, | 405 reportTimeToInitialActionClose: reportTimeToInitialActionClose, |
| 375 requestInitialData: requestInitialData, | 406 requestInitialData: requestInitialData, |
| 376 requestRoute: requestRoute, | 407 requestRoute: requestRoute, |
| 408 searchSinksAndCreateRoute: searchSinksAndCreateRoute, |
| 377 }; | 409 }; |
| 378 }); | 410 }); |
| OLD | NEW |