| 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_data.js"> | 5 <include src="media_router_data.js"> |
| 6 <include src="media_router_ui_interface.js"> | 6 <include src="media_router_ui_interface.js"> |
| 7 | 7 |
| 8 // Handles user events for the Media Router UI. | 8 // Handles user events for the Media Router UI. |
| 9 cr.define('media_router', function() { | 9 cr.define('media_router', function() { |
| 10 'use strict'; | 10 'use strict'; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 | 29 |
| 30 media_router.ui.setElements(container, | 30 media_router.ui.setElements(container, |
| 31 /** @type {!MediaRouterHeaderElement} */ | 31 /** @type {!MediaRouterHeaderElement} */ |
| 32 (container.$['container-header'])); | 32 (container.$['container-header'])); |
| 33 | 33 |
| 34 container.addEventListener('acknowledge-first-run-flow', | 34 container.addEventListener('acknowledge-first-run-flow', |
| 35 onAcknowledgeFirstRunFlow); | 35 onAcknowledgeFirstRunFlow); |
| 36 container.addEventListener('back-click', onNavigateToSinkList); | 36 container.addEventListener('back-click', onNavigateToSinkList); |
| 37 container.addEventListener('cast-mode-selected', onCastModeSelected); | 37 container.addEventListener('cast-mode-selected', onCastModeSelected); |
| 38 container.addEventListener('close-dialog', onCloseDialog); | 38 container.addEventListener('close-dialog', onCloseDialog); |
| 39 container.addEventListener('close-route-click', onCloseRouteClick); | 39 container.addEventListener('close-route', onCloseRoute); |
| 40 container.addEventListener('create-route', onCreateRoute); | 40 container.addEventListener('create-route', onCreateRoute); |
| 41 container.addEventListener('issue-action-click', onIssueActionClick); | 41 container.addEventListener('issue-action-click', onIssueActionClick); |
| 42 container.addEventListener('join-route-click', onJoinRouteClick); |
| 42 container.addEventListener('navigate-sink-list-to-details', | 43 container.addEventListener('navigate-sink-list-to-details', |
| 43 onNavigateToDetails); | 44 onNavigateToDetails); |
| 44 container.addEventListener('navigate-to-cast-mode-list', | 45 container.addEventListener('navigate-to-cast-mode-list', |
| 45 onNavigateToCastMode); | 46 onNavigateToCastMode); |
| 46 container.addEventListener('report-filter', onFilter); | 47 container.addEventListener('report-filter', onFilter); |
| 47 container.addEventListener('report-initial-action', onInitialAction); | 48 container.addEventListener('report-initial-action', onInitialAction); |
| 48 container.addEventListener('report-initial-action-close', | 49 container.addEventListener('report-initial-action-close', |
| 49 onInitialActionClose); | 50 onInitialActionClose); |
| 50 container.addEventListener('report-route-creation', onReportRouteCreation); | 51 container.addEventListener('report-route-creation', onReportRouteCreation); |
| 51 container.addEventListener('report-sink-click-time', | 52 container.addEventListener('report-sink-click-time', |
| 52 onSinkClickTimeReported); | 53 onSinkClickTimeReported); |
| 53 container.addEventListener('report-sink-count', onSinkCountReported); | 54 container.addEventListener('report-sink-count', onSinkCountReported); |
| 54 container.addEventListener('report-resolved-route', | 55 container.addEventListener('report-resolved-route', |
| 55 onReportRouteCreationOutcome); | 56 onReportRouteCreationOutcome); |
| 56 container.addEventListener('request-initial-data', | 57 container.addEventListener('request-initial-data', |
| 57 onRequestInitialData); | 58 onRequestInitialData); |
| 58 container.addEventListener('search-sinks-and-create-route', | 59 container.addEventListener('search-sinks-and-create-route', |
| 59 onSearchSinksAndCreateRoute); | 60 onSearchSinksAndCreateRoute); |
| 60 container.addEventListener('show-initial-state', onShowInitialState); | 61 container.addEventListener('show-initial-state', onShowInitialState); |
| 61 container.addEventListener('sink-click', onSinkClick); | 62 container.addEventListener('sink-click', onSinkClick); |
| 62 container.addEventListener('start-casting-to-route-click', | |
| 63 onStartCastingToRouteClick); | |
| 64 | 63 |
| 65 window.addEventListener('blur', onWindowBlur); | 64 window.addEventListener('blur', onWindowBlur); |
| 66 } | 65 } |
| 67 | 66 |
| 68 /** | 67 /** |
| 69 * Requests that the Media Router searches for a sink with criteria | 68 * Requests that the Media Router searches for a sink with criteria |
| 70 * |event.detail.name|. | 69 * |event.detail.name|. |
| 71 * @param {!Event} event | 70 * @param {!Event} event |
| 72 * Parameters in |event|.detail: | 71 * Parameters in |event|.detail: |
| 73 * id - id of the pseudo sink generating the request. | 72 * id - id of the pseudo sink generating the request. |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 } | 206 } |
| 208 | 207 |
| 209 /** | 208 /** |
| 210 * Stops a route. | 209 * Stops a route. |
| 211 * Called when the user requests to stop a media route. | 210 * Called when the user requests to stop a media route. |
| 212 * | 211 * |
| 213 * @param {!Event} event | 212 * @param {!Event} event |
| 214 * Parameters in |event|.detail: | 213 * Parameters in |event|.detail: |
| 215 * route - The route to close. | 214 * route - The route to close. |
| 216 */ | 215 */ |
| 217 function onCloseRouteClick(event) { | 216 function onCloseRoute(event) { |
| 218 /** @type {{route: !media_router.Route}} */ | 217 /** @type {{route: !media_router.Route}} */ |
| 219 var detail = event.detail; | 218 var detail = event.detail; |
| 220 media_router.browserApi.closeRoute(detail.route); | 219 media_router.browserApi.closeRoute(detail.route); |
| 221 } | 220 } |
| 222 | 221 |
| 223 /** | 222 /** |
| 224 * Starts casting to an existing route. | 223 * Starts casting to an existing route. |
| 225 * Called when the user requests to start casting to a media route. | 224 * Called when the user requests to start casting to a media route that is |
| 225 * joinable. |
| 226 * | 226 * |
| 227 * @param {!Event} event | 227 * @param {!Event} event |
| 228 * Parameters in |event|.detail: | 228 * Parameters in |event|.detail: |
| 229 * route - The route to connect to if possible. | 229 * route - The route to connect to if possible. |
| 230 */ | 230 */ |
| 231 function onStartCastingToRouteClick(event) { | 231 function onJoinRouteClick(event) { |
| 232 /** @type {{route: !media_router.Route}} */ | 232 /** @type {{route: !media_router.Route}} */ |
| 233 var detail = event.detail; | 233 var detail = event.detail; |
| 234 media_router.browserApi.joinRoute(detail.route); | 234 media_router.browserApi.joinRoute(detail.route); |
| 235 } | 235 } |
| 236 | 236 |
| 237 /** | 237 /** |
| 238 * Reports the user navigation to the cast mode view. | 238 * Reports the user navigation to the cast mode view. |
| 239 * Called when the user clicks the drop arrow to navigate to the cast mode | 239 * Called when the user clicks the drop arrow to navigate to the cast mode |
| 240 * view on the dialog. | 240 * view on the dialog. |
| 241 */ | 241 */ |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 362 function onWindowBlur() { | 362 function onWindowBlur() { |
| 363 media_router.browserApi.reportBlur(); | 363 media_router.browserApi.reportBlur(); |
| 364 } | 364 } |
| 365 | 365 |
| 366 return { | 366 return { |
| 367 initialize: initialize, | 367 initialize: initialize, |
| 368 }; | 368 }; |
| 369 }); | 369 }); |
| 370 | 370 |
| 371 window.addEventListener('load', media_router.initialize); | 371 window.addEventListener('load', media_router.initialize); |
| OLD | NEW |