| 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 onInitialActionClose); | 46 onInitialActionClose); |
| 47 container.addEventListener('report-route-creation', onReportRouteCreation); | 47 container.addEventListener('report-route-creation', onReportRouteCreation); |
| 48 container.addEventListener('report-sink-click-time', | 48 container.addEventListener('report-sink-click-time', |
| 49 onSinkClickTimeReported); | 49 onSinkClickTimeReported); |
| 50 container.addEventListener('report-sink-count', onSinkCountReported); | 50 container.addEventListener('report-sink-count', onSinkCountReported); |
| 51 container.addEventListener('show-initial-state', onShowInitialState); | 51 container.addEventListener('show-initial-state', onShowInitialState); |
| 52 container.addEventListener('sink-click', onSinkClick); | 52 container.addEventListener('sink-click', onSinkClick); |
| 53 container.addEventListener('start-casting-to-route-click', | 53 container.addEventListener('start-casting-to-route-click', |
| 54 onStartCastingToRouteClick); | 54 onStartCastingToRouteClick); |
| 55 | 55 |
| 56 // Pressing the ESC key closes the dialog. | |
| 57 document.addEventListener('keydown', function(e) { | |
| 58 if (e.keyCode == media_router.KEYCODE_ESC) { | |
| 59 container.maybeReportUserFirstAction( | |
| 60 media_router.MediaRouterUserAction.CLOSE); | |
| 61 } | |
| 62 }); | |
| 63 | |
| 64 window.addEventListener('blur', onWindowBlur); | 56 window.addEventListener('blur', onWindowBlur); |
| 65 } | 57 } |
| 66 | 58 |
| 67 /** | 59 /** |
| 68 * Reports the selected cast mode. | 60 * Reports the selected cast mode. |
| 69 * Called when the user selects a cast mode from the picker. | 61 * Called when the user selects a cast mode from the picker. |
| 70 * | 62 * |
| 71 * @param {!Event} event | 63 * @param {!Event} event |
| 72 * Parameters in |event|.detail: | 64 * Parameters in |event|.detail: |
| 73 * castModeType - type of cast mode selected by the user. | 65 * castModeType - type of cast mode selected by the user. |
| (...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 310 function onWindowBlur() { | 302 function onWindowBlur() { |
| 311 media_router.browserApi.reportBlur(); | 303 media_router.browserApi.reportBlur(); |
| 312 } | 304 } |
| 313 | 305 |
| 314 return { | 306 return { |
| 315 initialize: initialize, | 307 initialize: initialize, |
| 316 }; | 308 }; |
| 317 }); | 309 }); |
| 318 | 310 |
| 319 window.addEventListener('load', media_router.initialize); | 311 window.addEventListener('load', media_router.initialize); |
| OLD | NEW |