Chromium Code Reviews| 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', | |
| 41 onCloseRouteForNewMedia); | |
|
amp
2016/05/23 21:42:35
Can't this reuse the onCloseRouteClick handler as
btolsch
2016/05/23 22:41:10
It is identical, but I wasn't sure if it would be
apacible
2016/05/25 00:56:34
Reusing onCloseRouteClick is fine.
| |
| 40 container.addEventListener('create-route', onCreateRoute); | 42 container.addEventListener('create-route', onCreateRoute); |
| 41 container.addEventListener('issue-action-click', onIssueActionClick); | 43 container.addEventListener('issue-action-click', onIssueActionClick); |
| 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); |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 214 * Parameters in |event|.detail: | 216 * Parameters in |event|.detail: |
| 215 * route - The route to close. | 217 * route - The route to close. |
| 216 */ | 218 */ |
| 217 function onCloseRouteClick(event) { | 219 function onCloseRouteClick(event) { |
| 218 /** @type {{route: !media_router.Route}} */ | 220 /** @type {{route: !media_router.Route}} */ |
| 219 var detail = event.detail; | 221 var detail = event.detail; |
| 220 media_router.browserApi.closeRoute(detail.route); | 222 media_router.browserApi.closeRoute(detail.route); |
| 221 } | 223 } |
| 222 | 224 |
| 223 /** | 225 /** |
| 226 * Stops a route. | |
| 227 * Called when the user requests to cast to a sink that already has a route. | |
| 228 * | |
| 229 * @param {!Event} event | |
| 230 * Parameters in |event|.detail: | |
| 231 * route - The route to close. | |
| 232 */ | |
| 233 function onCloseRouteForNewMedia(event) { | |
| 234 /** @type {{route: !media_router.Route}} */ | |
| 235 var detail = event.detail; | |
| 236 media_router.browserApi.closeRoute(detail.route); | |
| 237 } | |
| 238 | |
| 239 /** | |
| 224 * Starts casting to an existing route. | 240 * Starts casting to an existing route. |
| 225 * Called when the user requests to start casting to a media route. | 241 * Called when the user requests to start casting to a media route. |
| 226 * | 242 * |
| 227 * @param {!Event} event | 243 * @param {!Event} event |
| 228 * Parameters in |event|.detail: | 244 * Parameters in |event|.detail: |
| 229 * route - The route to connect to if possible. | 245 * route - The route to connect to if possible. |
| 230 */ | 246 */ |
| 231 function onStartCastingToRouteClick(event) { | 247 function onStartCastingToRouteClick(event) { |
| 232 /** @type {{route: !media_router.Route}} */ | 248 /** @type {{route: !media_router.Route}} */ |
| 233 var detail = event.detail; | 249 var detail = event.detail; |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 362 function onWindowBlur() { | 378 function onWindowBlur() { |
| 363 media_router.browserApi.reportBlur(); | 379 media_router.browserApi.reportBlur(); |
| 364 } | 380 } |
| 365 | 381 |
| 366 return { | 382 return { |
| 367 initialize: initialize, | 383 initialize: initialize, |
| 368 }; | 384 }; |
| 369 }); | 385 }); |
| 370 | 386 |
| 371 window.addEventListener('load', media_router.initialize); | 387 window.addEventListener('load', media_router.initialize); |
| OLD | NEW |