| 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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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('show-initial-state', onShowInitialState); | 54 container.addEventListener('show-initial-state', onShowInitialState); |
| 55 container.addEventListener('sink-click', onSinkClick); | 55 container.addEventListener('sink-click', onSinkClick); |
| 56 container.addEventListener('start-casting-to-route-click', | 56 container.addEventListener('start-casting-to-route-click', |
| 57 onStartCastingToRouteClick); | 57 onStartCastingToRouteClick); |
| 58 | 58 |
| 59 // Pressing the ESC key closes the dialog. | |
| 60 document.addEventListener('keydown', function(e) { | |
| 61 if (e.keyCode == media_router.KEYCODE_ESC) { | |
| 62 container.maybeReportUserFirstAction( | |
| 63 media_router.MediaRouterUserAction.CLOSE); | |
| 64 } | |
| 65 }); | |
| 66 | |
| 67 window.addEventListener('blur', onWindowBlur); | 59 window.addEventListener('blur', onWindowBlur); |
| 68 } | 60 } |
| 69 | 61 |
| 70 /** | 62 /** |
| 71 * Reports the selected cast mode. | 63 * Reports the selected cast mode. |
| 72 * Called when the user selects a cast mode from the picker. | 64 * Called when the user selects a cast mode from the picker. |
| 73 * | 65 * |
| 74 * @param {!Event} event | 66 * @param {!Event} event |
| 75 * Parameters in |event|.detail: | 67 * Parameters in |event|.detail: |
| 76 * castModeType - type of cast mode selected by the user. | 68 * castModeType - type of cast mode selected by the user. |
| (...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 339 function onWindowBlur() { | 331 function onWindowBlur() { |
| 340 media_router.browserApi.reportBlur(); | 332 media_router.browserApi.reportBlur(); |
| 341 } | 333 } |
| 342 | 334 |
| 343 return { | 335 return { |
| 344 initialize: initialize, | 336 initialize: initialize, |
| 345 }; | 337 }; |
| 346 }); | 338 }); |
| 347 | 339 |
| 348 window.addEventListener('load', media_router.initialize); | 340 window.addEventListener('load', media_router.initialize); |
| OLD | NEW |