| 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 19 matching lines...) Expand all Loading... |
| 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-click', onCloseRouteClick); |
| 40 container.addEventListener('close-route-for-new-media', onCloseRouteClick); |
| 40 container.addEventListener('create-route', onCreateRoute); | 41 container.addEventListener('create-route', onCreateRoute); |
| 41 container.addEventListener('issue-action-click', onIssueActionClick); | 42 container.addEventListener('issue-action-click', onIssueActionClick); |
| 43 container.addEventListener('join-route-click', onJoinRouteClick); |
| 42 container.addEventListener('navigate-sink-list-to-details', | 44 container.addEventListener('navigate-sink-list-to-details', |
| 43 onNavigateToDetails); | 45 onNavigateToDetails); |
| 44 container.addEventListener('navigate-to-cast-mode-list', | 46 container.addEventListener('navigate-to-cast-mode-list', |
| 45 onNavigateToCastMode); | 47 onNavigateToCastMode); |
| 46 container.addEventListener('report-filter', onFilter); | 48 container.addEventListener('report-filter', onFilter); |
| 47 container.addEventListener('report-initial-action', onInitialAction); | 49 container.addEventListener('report-initial-action', onInitialAction); |
| 48 container.addEventListener('report-initial-action-close', | 50 container.addEventListener('report-initial-action-close', |
| 49 onInitialActionClose); | 51 onInitialActionClose); |
| 50 container.addEventListener('report-route-creation', onReportRouteCreation); | 52 container.addEventListener('report-route-creation', onReportRouteCreation); |
| 51 container.addEventListener('report-sink-click-time', | 53 container.addEventListener('report-sink-click-time', |
| 52 onSinkClickTimeReported); | 54 onSinkClickTimeReported); |
| 53 container.addEventListener('report-sink-count', onSinkCountReported); | 55 container.addEventListener('report-sink-count', onSinkCountReported); |
| 54 container.addEventListener('report-resolved-route', | 56 container.addEventListener('report-resolved-route', |
| 55 onReportRouteCreationOutcome); | 57 onReportRouteCreationOutcome); |
| 56 container.addEventListener('request-initial-data', | 58 container.addEventListener('request-initial-data', |
| 57 onRequestInitialData); | 59 onRequestInitialData); |
| 58 container.addEventListener('search-sinks-and-create-route', | 60 container.addEventListener('search-sinks-and-create-route', |
| 59 onSearchSinksAndCreateRoute); | 61 onSearchSinksAndCreateRoute); |
| 60 container.addEventListener('show-initial-state', onShowInitialState); | 62 container.addEventListener('show-initial-state', onShowInitialState); |
| 61 container.addEventListener('sink-click', onSinkClick); | 63 container.addEventListener('sink-click', onSinkClick); |
| 62 container.addEventListener('start-casting-to-route-click', | |
| 63 onStartCastingToRouteClick); | |
| 64 | 64 |
| 65 window.addEventListener('blur', onWindowBlur); | 65 window.addEventListener('blur', onWindowBlur); |
| 66 } | 66 } |
| 67 | 67 |
| 68 /** | 68 /** |
| 69 * Requests that the Media Router searches for a sink with criteria | 69 * Requests that the Media Router searches for a sink with criteria |
| 70 * |event.detail.name|. | 70 * |event.detail.name|. |
| 71 * @param {!Event} event | 71 * @param {!Event} event |
| 72 * Parameters in |event|.detail: | 72 * Parameters in |event|.detail: |
| 73 * id - id of the pseudo sink generating the request. | 73 * id - id of the pseudo sink generating the request. |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 215 * route - The route to close. | 215 * route - The route to close. |
| 216 */ | 216 */ |
| 217 function onCloseRouteClick(event) { | 217 function onCloseRouteClick(event) { |
| 218 /** @type {{route: !media_router.Route}} */ | 218 /** @type {{route: !media_router.Route}} */ |
| 219 var detail = event.detail; | 219 var detail = event.detail; |
| 220 media_router.browserApi.closeRoute(detail.route); | 220 media_router.browserApi.closeRoute(detail.route); |
| 221 } | 221 } |
| 222 | 222 |
| 223 /** | 223 /** |
| 224 * Starts casting to an existing route. | 224 * Starts casting to an existing route. |
| 225 * Called when the user requests to start casting to a media route. | 225 * Called when the user requests to start casting to a media route that is |
| 226 * joinable. |
| 226 * | 227 * |
| 227 * @param {!Event} event | 228 * @param {!Event} event |
| 228 * Parameters in |event|.detail: | 229 * Parameters in |event|.detail: |
| 229 * route - The route to connect to if possible. | 230 * route - The route to connect to if possible. |
| 230 */ | 231 */ |
| 231 function onStartCastingToRouteClick(event) { | 232 function onJoinRouteClick(event) { |
| 232 /** @type {{route: !media_router.Route}} */ | 233 /** @type {{route: !media_router.Route}} */ |
| 233 var detail = event.detail; | 234 var detail = event.detail; |
| 234 media_router.browserApi.joinRoute(detail.route); | 235 media_router.browserApi.joinRoute(detail.route); |
| 235 } | 236 } |
| 236 | 237 |
| 237 /** | 238 /** |
| 238 * Reports the user navigation to the cast mode view. | 239 * Reports the user navigation to the cast mode view. |
| 239 * Called when the user clicks the drop arrow to navigate to the cast mode | 240 * Called when the user clicks the drop arrow to navigate to the cast mode |
| 240 * view on the dialog. | 241 * view on the dialog. |
| 241 */ | 242 */ |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 362 function onWindowBlur() { | 363 function onWindowBlur() { |
| 363 media_router.browserApi.reportBlur(); | 364 media_router.browserApi.reportBlur(); |
| 364 } | 365 } |
| 365 | 366 |
| 366 return { | 367 return { |
| 367 initialize: initialize, | 368 initialize: initialize, |
| 368 }; | 369 }; |
| 369 }); | 370 }); |
| 370 | 371 |
| 371 window.addEventListener('load', media_router.initialize); | 372 window.addEventListener('load', media_router.initialize); |
| OLD | NEW |