| 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 11 matching lines...) Expand all Loading... |
| 22 container = $('media-router-container'); | 22 container = $('media-router-container'); |
| 23 media_router.ui.setContainer(container); | 23 media_router.ui.setContainer(container); |
| 24 | 24 |
| 25 container.addEventListener('back-click', onNavigateToSinkList); | 25 container.addEventListener('back-click', onNavigateToSinkList); |
| 26 container.addEventListener('cast-mode-selected', onCastModeSelected); | 26 container.addEventListener('cast-mode-selected', onCastModeSelected); |
| 27 container.addEventListener('close-button-click', onCloseDialogEvent); | 27 container.addEventListener('close-button-click', onCloseDialogEvent); |
| 28 container.addEventListener('close-dialog', onCloseDialogEvent); | 28 container.addEventListener('close-dialog', onCloseDialogEvent); |
| 29 container.addEventListener('close-route-click', onCloseRouteClick); | 29 container.addEventListener('close-route-click', onCloseRouteClick); |
| 30 container.addEventListener('create-route', onCreateRoute); | 30 container.addEventListener('create-route', onCreateRoute); |
| 31 container.addEventListener('issue-action-click', onIssueActionClick); | 31 container.addEventListener('issue-action-click', onIssueActionClick); |
| 32 container.addEventListener('join-route-click', onJoinRouteClick); |
| 32 container.addEventListener('navigate-sink-list-to-details', | 33 container.addEventListener('navigate-sink-list-to-details', |
| 33 onNavigateToDetails); | 34 onNavigateToDetails); |
| 34 container.addEventListener('navigate-to-cast-mode-list', | 35 container.addEventListener('navigate-to-cast-mode-list', |
| 35 onNavigateToCastMode); | 36 onNavigateToCastMode); |
| 36 container.addEventListener('report-sink-count', onSinkCountReported); | 37 container.addEventListener('report-sink-count', onSinkCountReported); |
| 37 container.addEventListener('sink-click', onSinkClick); | 38 container.addEventListener('sink-click', onSinkClick); |
| 38 } | 39 } |
| 39 | 40 |
| 40 /** | 41 /** |
| 41 * Reports the selected cast mode. | 42 * Reports the selected cast mode. |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 */ | 87 */ |
| 87 function onCreateRoute(data) { | 88 function onCreateRoute(data) { |
| 88 media_router.browserApi.requestRoute(data.detail.sinkId, | 89 media_router.browserApi.requestRoute(data.detail.sinkId, |
| 89 data.detail.selectedCastModeValue); | 90 data.detail.selectedCastModeValue); |
| 90 } | 91 } |
| 91 | 92 |
| 92 /** | 93 /** |
| 93 * Stops a route. | 94 * Stops a route. |
| 94 * Called when the user requests to stop a media route. | 95 * Called when the user requests to stop a media route. |
| 95 * | 96 * |
| 96 * @param {{detail: {route: string}}} data | 97 * @param {{detail: {route: media_router.Route}}} data |
| 97 * Parameters in |data|.detail: | 98 * Parameters in |data|.detail: |
| 98 * route - route ID. | 99 * route - route to close. |
| 99 */ | 100 */ |
| 100 function onCloseRouteClick(data) { | 101 function onCloseRouteClick(data) { |
| 101 media_router.browserApi.closeRoute(data.detail.route); | 102 media_router.browserApi.closeRoute(data.detail.route); |
| 102 } | 103 } |
| 103 | 104 |
| 104 /** | 105 /** |
| 106 * Joins a route. |
| 107 * Called when the user requests to join a media route. |
| 108 * |
| 109 * @param {{detail: {route: media_router.Route}}} data |
| 110 * Parameters in |data|.detail: |
| 111 * route - route to join. |
| 112 */ |
| 113 function onJoinRouteClick(data) { |
| 114 media_router.browserApi.joinRoute(data.detail.route); |
| 115 } |
| 116 |
| 117 /** |
| 118 * Reports the index of the sink that was clicked. |
| 119 * Called when the user selects a sink on the sink list. |
| 120 * |
| 121 * @param {{detail: {index: number}}} data |
| 122 * Paramters in |data|.detail: |
| 123 * index - the index of the clicked sink. |
| 124 */ |
| 125 function onSinkClick(data) { |
| 126 media_router.browserApi.reportClickedSinkIndex(data.detail.index); |
| 127 } |
| 128 |
| 129 /** |
| 105 * Reports the user navigation to the cast mode view. | 130 * Reports the user navigation to the cast mode view. |
| 106 * Called when the user clicks the drop arrow to navigate to the cast mode | 131 * Called when the user clicks the drop arrow to navigate to the cast mode |
| 107 * view on the dialog. | 132 * view on the dialog. |
| 108 */ | 133 */ |
| 109 function onNavigateToCastMode() { | 134 function onNavigateToCastMode() { |
| 110 media_router.browserApi.reportNavigateToView( | 135 media_router.browserApi.reportNavigateToView( |
| 111 media_router.MediaRouterView.CAST_MODE_LIST); | 136 media_router.MediaRouterView.CAST_MODE_LIST); |
| 112 } | 137 } |
| 113 | 138 |
| 114 /** | 139 /** |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 function onSinkCountReported(data) { | 179 function onSinkCountReported(data) { |
| 155 media_router.browserApi.reportSinkCount(data.detail.sinkCount); | 180 media_router.browserApi.reportSinkCount(data.detail.sinkCount); |
| 156 } | 181 } |
| 157 | 182 |
| 158 return { | 183 return { |
| 159 initialize: initialize, | 184 initialize: initialize, |
| 160 }; | 185 }; |
| 161 }); | 186 }); |
| 162 | 187 |
| 163 window.addEventListener('load', media_router.initialize); | 188 window.addEventListener('load', media_router.initialize); |
| OLD | NEW |