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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 44 container.addEventListener('report-filter', onFilter); | 44 container.addEventListener('report-filter', onFilter); |
| 45 container.addEventListener('report-initial-action', onInitialAction); | 45 container.addEventListener('report-initial-action', onInitialAction); |
| 46 container.addEventListener('report-initial-action-close', | 46 container.addEventListener('report-initial-action-close', |
| 47 onInitialActionClose); | 47 onInitialActionClose); |
| 48 container.addEventListener('report-route-creation', onReportRouteCreation); | 48 container.addEventListener('report-route-creation', onReportRouteCreation); |
| 49 container.addEventListener('report-sink-click-time', | 49 container.addEventListener('report-sink-click-time', |
| 50 onSinkClickTimeReported); | 50 onSinkClickTimeReported); |
| 51 container.addEventListener('report-sink-count', onSinkCountReported); | 51 container.addEventListener('report-sink-count', onSinkCountReported); |
| 52 container.addEventListener('report-resolved-route', | 52 container.addEventListener('report-resolved-route', |
| 53 onReportRouteCreationOutcome); | 53 onReportRouteCreationOutcome); |
| 54 container.addEventListener('search-sinks-and-create-route', | |
| 55 onSearchSinksAndCreateRoute); | |
| 54 container.addEventListener('show-initial-state', onShowInitialState); | 56 container.addEventListener('show-initial-state', onShowInitialState); |
| 55 container.addEventListener('sink-click', onSinkClick); | 57 container.addEventListener('sink-click', onSinkClick); |
| 56 container.addEventListener('start-casting-to-route-click', | 58 container.addEventListener('start-casting-to-route-click', |
| 57 onStartCastingToRouteClick); | 59 onStartCastingToRouteClick); |
| 58 | 60 |
| 59 window.addEventListener('blur', onWindowBlur); | 61 window.addEventListener('blur', onWindowBlur); |
| 60 } | 62 } |
| 61 | 63 |
| 62 /** | 64 /** |
| 65 * Requests that the Media Router searches for a sink with criteria | |
| 66 * |event.detail.name|. | |
| 67 * @param {!Event} event | |
| 68 * Parameters in |event|.detail: | |
| 69 * id - id of the pseudo sink generating the request. | |
| 70 * name - sink search criteria. | |
| 71 * domain - user's current domain. | |
| 72 * selectedCastMode - type of cast mode selected by the user. | |
| 73 */ | |
| 74 function onSearchSinksAndCreateRoute(event) { | |
| 75 var detail = event.detail; | |
|
apacible
2016/04/06 21:27:02
nit: Add /** @type {{ ... }} */
btolsch
2016/04/08 09:31:25
Done.
| |
| 76 media_router.browserApi.searchSinksAndCreateRoute( | |
| 77 detail.id, detail.name, detail.domain, detail.selectedCastMode); | |
| 78 } | |
| 79 | |
| 80 /** | |
| 63 * Reports the selected cast mode. | 81 * Reports the selected cast mode. |
| 64 * Called when the user selects a cast mode from the picker. | 82 * Called when the user selects a cast mode from the picker. |
| 65 * | 83 * |
| 66 * @param {!Event} event | 84 * @param {!Event} event |
| 67 * Parameters in |event|.detail: | 85 * Parameters in |event|.detail: |
| 68 * castModeType - type of cast mode selected by the user. | 86 * castModeType - type of cast mode selected by the user. |
| 69 */ | 87 */ |
| 70 function onCastModeSelected(event) { | 88 function onCastModeSelected(event) { |
| 71 /** @type {{castModeType: number}} */ | 89 /** @type {{castModeType: number}} */ |
| 72 var detail = event.detail; | 90 var detail = event.detail; |
| (...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 331 function onWindowBlur() { | 349 function onWindowBlur() { |
| 332 media_router.browserApi.reportBlur(); | 350 media_router.browserApi.reportBlur(); |
| 333 } | 351 } |
| 334 | 352 |
| 335 return { | 353 return { |
| 336 initialize: initialize, | 354 initialize: initialize, |
| 337 }; | 355 }; |
| 338 }); | 356 }); |
| 339 | 357 |
| 340 window.addEventListener('load', media_router.initialize); | 358 window.addEventListener('load', media_router.initialize); |
| OLD | NEW |