| 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 17 matching lines...) Expand all Loading... |
| 28 ($('media-router-container')); | 28 ($('media-router-container')); |
| 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('change-route-source-click', |
| 39 onChangeRouteSourceClick); |
| 38 container.addEventListener('close-dialog', onCloseDialog); | 40 container.addEventListener('close-dialog', onCloseDialog); |
| 39 container.addEventListener('close-route', onCloseRoute); | 41 container.addEventListener('close-route', onCloseRoute); |
| 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('join-route-click', onJoinRouteClick); | 44 container.addEventListener('join-route-click', onJoinRouteClick); |
| 43 container.addEventListener('navigate-sink-list-to-details', | 45 container.addEventListener('navigate-sink-list-to-details', |
| 44 onNavigateToDetails); | 46 onNavigateToDetails); |
| 45 container.addEventListener('navigate-to-cast-mode-list', | 47 container.addEventListener('navigate-to-cast-mode-list', |
| 46 onNavigateToCastMode); | 48 onNavigateToCastMode); |
| 47 container.addEventListener('report-filter', onFilter); | 49 container.addEventListener('report-filter', onFilter); |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 * Parameters in |event|.detail: | 92 * Parameters in |event|.detail: |
| 91 * castModeType - type of cast mode selected by the user. | 93 * castModeType - type of cast mode selected by the user. |
| 92 */ | 94 */ |
| 93 function onCastModeSelected(event) { | 95 function onCastModeSelected(event) { |
| 94 /** @type {{castModeType: number}} */ | 96 /** @type {{castModeType: number}} */ |
| 95 var detail = event.detail; | 97 var detail = event.detail; |
| 96 media_router.browserApi.reportSelectedCastMode(detail.castModeType); | 98 media_router.browserApi.reportSelectedCastMode(detail.castModeType); |
| 97 } | 99 } |
| 98 | 100 |
| 99 /** | 101 /** |
| 102 * Reports the route for which the users wants to replace the source and the |
| 103 * cast mode that should be used for the new source. |
| 104 * |
| 105 * @param {!Event} event The event object. |
| 106 * Parameters in |event|.detail: |
| 107 * route - route to modify. |
| 108 * selectedCastMode - type of cast mode selected by the user. |
| 109 */ |
| 110 function onChangeRouteSourceClick(event) { |
| 111 /** @type {{route: !media_router.Route, selectedCastMode: number}} */ |
| 112 var detail = event.detail; |
| 113 media_router.browserApi.changeRouteSource( |
| 114 detail.route, detail.selectedCastMode); |
| 115 } |
| 116 |
| 117 /** |
| 100 * Updates the preference that the user has seen the first run flow. | 118 * Updates the preference that the user has seen the first run flow. |
| 101 * Called when the user clicks on the acknowledgement button on the first run | 119 * Called when the user clicks on the acknowledgement button on the first run |
| 102 * flow. | 120 * flow. |
| 103 * | 121 * |
| 104 * @param {!Event} event | 122 * @param {!Event} event |
| 105 * Parameters in |event|.detail: | 123 * Parameters in |event|.detail: |
| 106 * optedIntoCloudServices - whether or not the user opted into cloud | 124 * optedIntoCloudServices - whether or not the user opted into cloud |
| 107 * services. | 125 * services. |
| 108 */ | 126 */ |
| 109 function onAcknowledgeFirstRunFlow(event) { | 127 function onAcknowledgeFirstRunFlow(event) { |
| (...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 362 function onWindowBlur() { | 380 function onWindowBlur() { |
| 363 media_router.browserApi.reportBlur(); | 381 media_router.browserApi.reportBlur(); |
| 364 } | 382 } |
| 365 | 383 |
| 366 return { | 384 return { |
| 367 initialize: initialize, | 385 initialize: initialize, |
| 368 }; | 386 }; |
| 369 }); | 387 }); |
| 370 | 388 |
| 371 window.addEventListener('load', media_router.initialize); | 389 window.addEventListener('load', media_router.initialize); |
| OLD | NEW |