| 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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 * firstRunFlowLearnMoreUrl - url to open when the first run flow learn | 68 * firstRunFlowLearnMoreUrl - url to open when the first run flow learn |
| 69 * more link is clicked. | 69 * more link is clicked. |
| 70 * wasFirstRunFlowAcknowledged - true if first run flow was previously | 70 * wasFirstRunFlowAcknowledged - true if first run flow was previously |
| 71 * acknowledged by user. | 71 * acknowledged by user. |
| 72 * showFirstRunFlowCloudPref - true if the cloud pref option should be | 72 * showFirstRunFlowCloudPref - true if the cloud pref option should be |
| 73 * shown. | 73 * shown. |
| 74 */ | 74 */ |
| 75 function setFirstRunFlowData(data) { | 75 function setFirstRunFlowData(data) { |
| 76 container.firstRunFlowCloudPrefLearnMoreUrl = | 76 container.firstRunFlowCloudPrefLearnMoreUrl = |
| 77 data['firstRunFlowCloudPrefLearnMoreUrl']; | 77 data['firstRunFlowCloudPrefLearnMoreUrl']; |
| 78 container.firstRunFlowLearnMoreUrl = | 78 container.firstRunFlowLearnMoreUrl = data['firstRunFlowLearnMoreUrl']; |
| 79 data['firstRunFlowLearnMoreUrl']; | 79 container.showFirstRunFlowCloudPref = data['showFirstRunFlowCloudPref']; |
| 80 container.showFirstRunFlowCloudPref = | |
| 81 data['showFirstRunFlowCloudPref']; | |
| 82 // Some users acknowledged the first run flow before the cloud prefs | 80 // Some users acknowledged the first run flow before the cloud prefs |
| 83 // setting was implemented. These users will see the first run flow | 81 // setting was implemented. These users will see the first run flow |
| 84 // again. | 82 // again. |
| 85 container.showFirstRunFlow = !data['wasFirstRunFlowAcknowledged'] || | 83 container.showFirstRunFlow = !data['wasFirstRunFlowAcknowledged'] || |
| 86 container.showFirstRunFlowCloudPref; | 84 container.showFirstRunFlowCloudPref; |
| 87 } | 85 } |
| 88 | 86 |
| 89 /** | 87 /** |
| 90 * Populates the WebUI with data obtained from Media Router. | 88 * Populates the WebUI with data obtained from Media Router. |
| 91 * | 89 * |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 } | 193 } |
| 196 | 194 |
| 197 /** | 195 /** |
| 198 * Acts on the given issue. | 196 * Acts on the given issue. |
| 199 * | 197 * |
| 200 * @param {number} issueId | 198 * @param {number} issueId |
| 201 * @param {number} actionType Type of action that the user clicked. | 199 * @param {number} actionType Type of action that the user clicked. |
| 202 * @param {?number} helpPageId The numeric help center ID. | 200 * @param {?number} helpPageId The numeric help center ID. |
| 203 */ | 201 */ |
| 204 function actOnIssue(issueId, actionType, helpPageId) { | 202 function actOnIssue(issueId, actionType, helpPageId) { |
| 205 chrome.send('actOnIssue', [{issueId: issueId, actionType: actionType, | 203 chrome.send( |
| 206 helpPageId: helpPageId}]); | 204 'actOnIssue', |
| 205 [{issueId: issueId, actionType: actionType, helpPageId: helpPageId}]); |
| 207 } | 206 } |
| 208 | 207 |
| 209 /** | 208 /** |
| 210 * Modifies |route| by changing its source to the one identified by | 209 * Modifies |route| by changing its source to the one identified by |
| 211 * |selectedCastMode|. | 210 * |selectedCastMode|. |
| 212 * | 211 * |
| 213 * @param {!media_router.Route} route The route being modified. | 212 * @param {!media_router.Route} route The route being modified. |
| 214 * @param {number} selectedCastMode The value of the cast mode the user | 213 * @param {number} selectedCastMode The value of the cast mode the user |
| 215 * selected. | 214 * selected. |
| 216 */ | 215 */ |
| 217 function changeRouteSource(route, selectedCastMode) { | 216 function changeRouteSource(route, selectedCastMode) { |
| 218 chrome.send('requestRoute', | 217 chrome.send( |
| 219 [{sinkId: route.sinkId, selectedCastMode: selectedCastMode}]); | 218 'requestRoute', |
| 219 [{sinkId: route.sinkId, selectedCastMode: selectedCastMode}]); |
| 220 } | 220 } |
| 221 | 221 |
| 222 /** | 222 /** |
| 223 * Closes the dialog. | 223 * Closes the dialog. |
| 224 * | 224 * |
| 225 * @param {boolean} pressEscToClose Whether the user pressed ESC to close the | 225 * @param {boolean} pressEscToClose Whether the user pressed ESC to close the |
| 226 * dialog. | 226 * dialog. |
| 227 */ | 227 */ |
| 228 function closeDialog(pressEscToClose) { | 228 function closeDialog(pressEscToClose) { |
| 229 chrome.send('closeDialog', [pressEscToClose]); | 229 chrome.send('closeDialog', [pressEscToClose]); |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 369 } | 369 } |
| 370 | 370 |
| 371 /** | 371 /** |
| 372 * Requests that a media route be started with the given sink. | 372 * Requests that a media route be started with the given sink. |
| 373 * | 373 * |
| 374 * @param {string} sinkId The sink ID. | 374 * @param {string} sinkId The sink ID. |
| 375 * @param {number} selectedCastMode The value of the cast mode the user | 375 * @param {number} selectedCastMode The value of the cast mode the user |
| 376 * selected. | 376 * selected. |
| 377 */ | 377 */ |
| 378 function requestRoute(sinkId, selectedCastMode) { | 378 function requestRoute(sinkId, selectedCastMode) { |
| 379 chrome.send('requestRoute', | 379 chrome.send( |
| 380 [{sinkId: sinkId, selectedCastMode: selectedCastMode}]); | 380 'requestRoute', [{sinkId: sinkId, selectedCastMode: selectedCastMode}]); |
| 381 } | 381 } |
| 382 | 382 |
| 383 /** | 383 /** |
| 384 * Requests that the media router search all providers for a sink matching | 384 * Requests that the media router search all providers for a sink matching |
| 385 * |searchCriteria| that can be used with the media source associated with the | 385 * |searchCriteria| that can be used with the media source associated with the |
| 386 * cast mode |selectedCastMode|. If such a sink is found, a route is also | 386 * cast mode |selectedCastMode|. If such a sink is found, a route is also |
| 387 * created between the sink and the media source. | 387 * created between the sink and the media source. |
| 388 * | 388 * |
| 389 * @param {string} sinkId Sink ID of the pseudo sink generating the request. | 389 * @param {string} sinkId Sink ID of the pseudo sink generating the request. |
| 390 * @param {string} searchCriteria Search criteria for the route providers. | 390 * @param {string} searchCriteria Search criteria for the route providers. |
| 391 * @param {string} domain User's current hosted domain. | 391 * @param {string} domain User's current hosted domain. |
| 392 * @param {number} selectedCastMode The value of the cast mode to be used with | 392 * @param {number} selectedCastMode The value of the cast mode to be used with |
| 393 * the sink. | 393 * the sink. |
| 394 */ | 394 */ |
| 395 function searchSinksAndCreateRoute( | 395 function searchSinksAndCreateRoute( |
| 396 sinkId, searchCriteria, domain, selectedCastMode) { | 396 sinkId, searchCriteria, domain, selectedCastMode) { |
| 397 chrome.send('searchSinksAndCreateRoute', | 397 chrome.send('searchSinksAndCreateRoute', [{ |
| 398 [{sinkId: sinkId, | 398 sinkId: sinkId, |
| 399 searchCriteria: searchCriteria, | 399 searchCriteria: searchCriteria, |
| 400 domain: domain, | 400 domain: domain, |
| 401 selectedCastMode: selectedCastMode}]); | 401 selectedCastMode: selectedCastMode |
| 402 }]); |
| 402 } | 403 } |
| 403 | 404 |
| 404 return { | 405 return { |
| 405 acknowledgeFirstRunFlow: acknowledgeFirstRunFlow, | 406 acknowledgeFirstRunFlow: acknowledgeFirstRunFlow, |
| 406 actOnIssue: actOnIssue, | 407 actOnIssue: actOnIssue, |
| 407 changeRouteSource: changeRouteSource, | 408 changeRouteSource: changeRouteSource, |
| 408 closeDialog: closeDialog, | 409 closeDialog: closeDialog, |
| 409 closeRoute: closeRoute, | 410 closeRoute: closeRoute, |
| 410 joinRoute: joinRoute, | 411 joinRoute: joinRoute, |
| 411 onInitialDataReceived: onInitialDataReceived, | 412 onInitialDataReceived: onInitialDataReceived, |
| 412 reportBlur: reportBlur, | 413 reportBlur: reportBlur, |
| 413 reportClickedSinkIndex: reportClickedSinkIndex, | 414 reportClickedSinkIndex: reportClickedSinkIndex, |
| 414 reportFilter: reportFilter, | 415 reportFilter: reportFilter, |
| 415 reportInitialAction: reportInitialAction, | 416 reportInitialAction: reportInitialAction, |
| 416 reportInitialState: reportInitialState, | 417 reportInitialState: reportInitialState, |
| 417 reportNavigateToView: reportNavigateToView, | 418 reportNavigateToView: reportNavigateToView, |
| 418 reportRouteCreation: reportRouteCreation, | 419 reportRouteCreation: reportRouteCreation, |
| 419 reportRouteCreationOutcome: reportRouteCreationOutcome, | 420 reportRouteCreationOutcome: reportRouteCreationOutcome, |
| 420 reportSelectedCastMode: reportSelectedCastMode, | 421 reportSelectedCastMode: reportSelectedCastMode, |
| 421 reportSinkCount: reportSinkCount, | 422 reportSinkCount: reportSinkCount, |
| 422 reportTimeToClickSink: reportTimeToClickSink, | 423 reportTimeToClickSink: reportTimeToClickSink, |
| 423 reportTimeToInitialActionClose: reportTimeToInitialActionClose, | 424 reportTimeToInitialActionClose: reportTimeToInitialActionClose, |
| 424 requestInitialData: requestInitialData, | 425 requestInitialData: requestInitialData, |
| 425 requestRoute: requestRoute, | 426 requestRoute: requestRoute, |
| 426 searchSinksAndCreateRoute: searchSinksAndCreateRoute, | 427 searchSinksAndCreateRoute: searchSinksAndCreateRoute, |
| 427 }; | 428 }; |
| 428 }); | 429 }); |
| OLD | NEW |