| 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 13 matching lines...) Expand all Loading... |
| 24 | 24 |
| 25 container = /** @type {!MediaRouterContainerElement} */ | 25 container = /** @type {!MediaRouterContainerElement} */ |
| 26 ($('media-router-container')); | 26 ($('media-router-container')); |
| 27 | 27 |
| 28 media_router.ui.setElements(container, | 28 media_router.ui.setElements(container, |
| 29 /** @type {!MediaRouterHeaderElement} */ | 29 /** @type {!MediaRouterHeaderElement} */ |
| 30 (container.$['container-header'])); | 30 (container.$['container-header'])); |
| 31 | 31 |
| 32 container.addEventListener('acknowledge-first-run-flow', | 32 container.addEventListener('acknowledge-first-run-flow', |
| 33 onAcknowledgeFirstRunFlow); | 33 onAcknowledgeFirstRunFlow); |
| 34 container.addEventListener('add-hangout', onAddHangout); |
| 34 container.addEventListener('back-click', onNavigateToSinkList); | 35 container.addEventListener('back-click', onNavigateToSinkList); |
| 35 container.addEventListener('cast-mode-selected', onCastModeSelected); | 36 container.addEventListener('cast-mode-selected', onCastModeSelected); |
| 36 container.addEventListener('close-dialog', onCloseDialog); | 37 container.addEventListener('close-dialog', onCloseDialog); |
| 37 container.addEventListener('close-route-click', onCloseRouteClick); | 38 container.addEventListener('close-route-click', onCloseRouteClick); |
| 38 container.addEventListener('create-route', onCreateRoute); | 39 container.addEventListener('create-route', onCreateRoute); |
| 39 container.addEventListener('issue-action-click', onIssueActionClick); | 40 container.addEventListener('issue-action-click', onIssueActionClick); |
| 40 container.addEventListener('navigate-sink-list-to-details', | 41 container.addEventListener('navigate-sink-list-to-details', |
| 41 onNavigateToDetails); | 42 onNavigateToDetails); |
| 42 container.addEventListener('navigate-to-cast-mode-list', | 43 container.addEventListener('navigate-to-cast-mode-list', |
| 43 onNavigateToCastMode); | 44 onNavigateToCastMode); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 60 if (e.keyCode == media_router.KEYCODE_ESC) { | 61 if (e.keyCode == media_router.KEYCODE_ESC) { |
| 61 container.maybeReportUserFirstAction( | 62 container.maybeReportUserFirstAction( |
| 62 media_router.MediaRouterUserAction.CLOSE); | 63 media_router.MediaRouterUserAction.CLOSE); |
| 63 } | 64 } |
| 64 }); | 65 }); |
| 65 | 66 |
| 66 window.addEventListener('blur', onWindowBlur); | 67 window.addEventListener('blur', onWindowBlur); |
| 67 } | 68 } |
| 68 | 69 |
| 69 /** | 70 /** |
| 71 * Requests that the Media Router searches for a sink named |
| 72 * |event.detail.name|. |
| 73 * @param {!Event} event |
| 74 * Parameters in |event|.detail: |
| 75 * name - Name of the sink to search for. |
| 76 * selectedCastMode - type of cast mode selected by the user. |
| 77 */ |
| 78 function onAddHangout(event) { |
| 79 var detail = event.detail; |
| 80 media_router.browserApi.searchProviders(detail.name, |
| 81 detail.selectedCastMode); |
| 82 } |
| 83 |
| 84 /** |
| 70 * Reports the selected cast mode. | 85 * Reports the selected cast mode. |
| 71 * Called when the user selects a cast mode from the picker. | 86 * Called when the user selects a cast mode from the picker. |
| 72 * | 87 * |
| 73 * @param {!Event} event | 88 * @param {!Event} event |
| 74 * Parameters in |event|.detail: | 89 * Parameters in |event|.detail: |
| 75 * castModeType - type of cast mode selected by the user. | 90 * castModeType - type of cast mode selected by the user. |
| 76 */ | 91 */ |
| 77 function onCastModeSelected(event) { | 92 function onCastModeSelected(event) { |
| 78 /** @type {{castModeType: number}} */ | 93 /** @type {{castModeType: number}} */ |
| 79 var detail = event.detail; | 94 var detail = event.detail; |
| (...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 329 function onWindowBlur() { | 344 function onWindowBlur() { |
| 330 media_router.browserApi.reportBlur(); | 345 media_router.browserApi.reportBlur(); |
| 331 } | 346 } |
| 332 | 347 |
| 333 return { | 348 return { |
| 334 initialize: initialize, | 349 initialize: initialize, |
| 335 }; | 350 }; |
| 336 }); | 351 }); |
| 337 | 352 |
| 338 window.addEventListener('load', media_router.initialize); | 353 window.addEventListener('load', media_router.initialize); |
| OLD | NEW |