| 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 // <include src="media_router_browser_api.js"> | 5 // <include src="media_router_browser_api.js"> |
| 6 // <include src="media_router_data.js"> | 6 // <include src="media_router_data.js"> |
| 7 // <include src="media_router_ui_interface.js"> | 7 // <include src="media_router_ui_interface.js"> |
| 8 | 8 |
| 9 // Handles user events for the Media Router UI. | 9 // Handles user events for the Media Router UI. |
| 10 cr.define('media_router', function() { | 10 cr.define('media_router', function() { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 * router content, such as the media sink and media route lists. | 21 * router content, such as the media sink and media route lists. |
| 22 */ | 22 */ |
| 23 function initialize() { | 23 function initialize() { |
| 24 // For non-Mac platforms, request data immediately after initialization. | 24 // For non-Mac platforms, request data immediately after initialization. |
| 25 if (!cr.isMac) | 25 if (!cr.isMac) |
| 26 onRequestInitialData(); | 26 onRequestInitialData(); |
| 27 | 27 |
| 28 container = /** @type {!MediaRouterContainerElement} */ | 28 container = /** @type {!MediaRouterContainerElement} */ |
| 29 ($('media-router-container')); | 29 ($('media-router-container')); |
| 30 | 30 |
| 31 media_router.ui.setElements(container, | 31 media_router.ui.setElements( |
| 32 /** @type {!MediaRouterHeaderElement} */(container.header)); | 32 container, |
| 33 /** @type {!MediaRouterHeaderElement} */ (container.header)); |
| 33 | 34 |
| 34 container.addEventListener('acknowledge-first-run-flow', | 35 container.addEventListener( |
| 35 onAcknowledgeFirstRunFlow); | 36 'acknowledge-first-run-flow', onAcknowledgeFirstRunFlow); |
| 36 container.addEventListener('back-click', onNavigateToSinkList); | 37 container.addEventListener('back-click', onNavigateToSinkList); |
| 37 container.addEventListener('cast-mode-selected', onCastModeSelected); | 38 container.addEventListener('cast-mode-selected', onCastModeSelected); |
| 38 container.addEventListener('change-route-source-click', | 39 container.addEventListener( |
| 39 onChangeRouteSourceClick); | 40 'change-route-source-click', onChangeRouteSourceClick); |
| 40 container.addEventListener('close-dialog', onCloseDialog); | 41 container.addEventListener('close-dialog', onCloseDialog); |
| 41 container.addEventListener('close-route', onCloseRoute); | 42 container.addEventListener('close-route', onCloseRoute); |
| 42 container.addEventListener('create-route', onCreateRoute); | 43 container.addEventListener('create-route', onCreateRoute); |
| 43 container.addEventListener('issue-action-click', onIssueActionClick); | 44 container.addEventListener('issue-action-click', onIssueActionClick); |
| 44 container.addEventListener('join-route-click', onJoinRouteClick); | 45 container.addEventListener('join-route-click', onJoinRouteClick); |
| 45 container.addEventListener('navigate-sink-list-to-details', | 46 container.addEventListener( |
| 46 onNavigateToDetails); | 47 'navigate-sink-list-to-details', onNavigateToDetails); |
| 47 container.addEventListener('navigate-to-cast-mode-list', | 48 container.addEventListener( |
| 48 onNavigateToCastMode); | 49 'navigate-to-cast-mode-list', onNavigateToCastMode); |
| 49 container.addEventListener( | 50 container.addEventListener( |
| 50 'select-local-media-file', onSelectLocalMediaFile); | 51 'select-local-media-file', onSelectLocalMediaFile); |
| 51 container.addEventListener('report-filter', onFilter); | 52 container.addEventListener('report-filter', onFilter); |
| 52 container.addEventListener('report-initial-action', onInitialAction); | 53 container.addEventListener('report-initial-action', onInitialAction); |
| 53 container.addEventListener('report-initial-action-close', | 54 container.addEventListener( |
| 54 onInitialActionClose); | 55 'report-initial-action-close', onInitialActionClose); |
| 55 container.addEventListener('report-route-creation', onReportRouteCreation); | 56 container.addEventListener('report-route-creation', onReportRouteCreation); |
| 56 container.addEventListener('report-sink-click-time', | 57 container.addEventListener( |
| 57 onSinkClickTimeReported); | 58 'report-sink-click-time', onSinkClickTimeReported); |
| 58 container.addEventListener('report-sink-count', onSinkCountReported); | 59 container.addEventListener('report-sink-count', onSinkCountReported); |
| 59 container.addEventListener('report-resolved-route', | 60 container.addEventListener( |
| 60 onReportRouteCreationOutcome); | 61 'report-resolved-route', onReportRouteCreationOutcome); |
| 61 container.addEventListener('request-initial-data', | 62 container.addEventListener('request-initial-data', onRequestInitialData); |
| 62 onRequestInitialData); | 63 container.addEventListener( |
| 63 container.addEventListener('search-sinks-and-create-route', | 64 'search-sinks-and-create-route', onSearchSinksAndCreateRoute); |
| 64 onSearchSinksAndCreateRoute); | |
| 65 container.addEventListener('show-initial-state', onShowInitialState); | 65 container.addEventListener('show-initial-state', onShowInitialState); |
| 66 container.addEventListener('sink-click', onSinkClick); | 66 container.addEventListener('sink-click', onSinkClick); |
| 67 | 67 |
| 68 window.addEventListener('blur', onWindowBlur); | 68 window.addEventListener('blur', onWindowBlur); |
| 69 } | 69 } |
| 70 | 70 |
| 71 /** | 71 /** |
| 72 * Requests that the Media Router searches for a sink with criteria | 72 * Requests that the Media Router searches for a sink with criteria |
| 73 * |event.detail.name|. | 73 * |event.detail.name|. |
| 74 * @param {!Event} event | 74 * @param {!Event} event |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 * | 203 * |
| 204 * @param {!Event} event | 204 * @param {!Event} event |
| 205 * Parameters in |event|.detail: | 205 * Parameters in |event|.detail: |
| 206 * id - issue ID. | 206 * id - issue ID. |
| 207 * actionType - type of action performed by the user. | 207 * actionType - type of action performed by the user. |
| 208 * helpPageId - the numeric help center ID. | 208 * helpPageId - the numeric help center ID. |
| 209 */ | 209 */ |
| 210 function onIssueActionClick(event) { | 210 function onIssueActionClick(event) { |
| 211 /** @type {{id: number, actionType: number, helpPageId: number}} */ | 211 /** @type {{id: number, actionType: number, helpPageId: number}} */ |
| 212 var detail = event.detail; | 212 var detail = event.detail; |
| 213 media_router.browserApi.actOnIssue(detail.id, | 213 media_router.browserApi.actOnIssue( |
| 214 detail.actionType, | 214 detail.id, detail.actionType, detail.helpPageId); |
| 215 detail.helpPageId); | |
| 216 container.issue = null; | 215 container.issue = null; |
| 217 } | 216 } |
| 218 | 217 |
| 219 /** | 218 /** |
| 220 * Creates a media route. | 219 * Creates a media route. |
| 221 * Called when the user requests to create a media route. | 220 * Called when the user requests to create a media route. |
| 222 * | 221 * |
| 223 * @param {!Event} event | 222 * @param {!Event} event |
| 224 * Parameters in |event|.detail: | 223 * Parameters in |event|.detail: |
| 225 * sinkId - sink ID selected by the user. | 224 * sinkId - sink ID selected by the user. |
| 226 * selectedCastModeValue - cast mode selected by the user. | 225 * selectedCastModeValue - cast mode selected by the user. |
| 227 */ | 226 */ |
| 228 function onCreateRoute(event) { | 227 function onCreateRoute(event) { |
| 229 /** @type {{sinkId: string, selectedCastModeValue: number}} */ | 228 /** @type {{sinkId: string, selectedCastModeValue: number}} */ |
| 230 var detail = event.detail; | 229 var detail = event.detail; |
| 231 media_router.browserApi.requestRoute(detail.sinkId, | 230 media_router.browserApi.requestRoute( |
| 232 detail.selectedCastModeValue); | 231 detail.sinkId, detail.selectedCastModeValue); |
| 233 } | 232 } |
| 234 | 233 |
| 235 /** | 234 /** |
| 236 * Stops a route. | 235 * Stops a route. |
| 237 * Called when the user requests to stop a media route. | 236 * Called when the user requests to stop a media route. |
| 238 * | 237 * |
| 239 * @param {!Event} event | 238 * @param {!Event} event |
| 240 * Parameters in |event|.detail: | 239 * Parameters in |event|.detail: |
| 241 * route - The route to close. | 240 * route - The route to close. |
| 242 */ | 241 */ |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 389 function onWindowBlur() { | 388 function onWindowBlur() { |
| 390 media_router.browserApi.reportBlur(); | 389 media_router.browserApi.reportBlur(); |
| 391 } | 390 } |
| 392 | 391 |
| 393 return { | 392 return { |
| 394 initialize: initialize, | 393 initialize: initialize, |
| 395 }; | 394 }; |
| 396 }); | 395 }); |
| 397 | 396 |
| 398 window.addEventListener('load', media_router.initialize); | 397 window.addEventListener('load', media_router.initialize); |
| OLD | NEW |