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'; |
11 | 11 |
12 // The media-router-container element. Initialized after polymer is ready. | 12 // The media-router-container element. Initialized after polymer is ready. |
13 var container = null; | 13 var container = null; |
14 | 14 |
15 /** | 15 /** |
16 * Initializes the Media Router WebUI and requests initial media | 16 * Initializes the Media Router WebUI and requests initial media |
17 * router content, such as the media sink and media route lists. | 17 * router content, such as the media sink and media route lists. |
18 */ | 18 */ |
19 function initialize() { | 19 function initialize() { |
20 media_router.browserApi.requestInitialData(); | 20 media_router.browserApi.requestInitialData(); |
21 | 21 |
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('close-button-click', onCloseDialogClick); | 25 container.addEventListener('close-button-click', onCloseDialogEvent); |
| 26 container.addEventListener('close-dialog', onCloseDialogEvent); |
26 container.addEventListener('close-route-click', onCloseRouteClick); | 27 container.addEventListener('close-route-click', onCloseRouteClick); |
27 container.addEventListener('create-route', onCreateRoute); | 28 container.addEventListener('create-route', onCreateRoute); |
28 container.addEventListener('issue-action-click', onIssueActionClick); | 29 container.addEventListener('issue-action-click', onIssueActionClick); |
29 } | 30 } |
30 | 31 |
31 /** | 32 /** |
32 * Closes the dialog. | 33 * Closes the dialog. |
33 * Called when the user clicks the close button on the dialog. | 34 * Called when the user clicks the close button on the dialog. |
34 */ | 35 */ |
35 function onCloseDialogClick() { | 36 function onCloseDialogEvent() { |
36 media_router.browserApi.closeDialog(); | 37 media_router.browserApi.closeDialog(); |
37 } | 38 } |
38 | 39 |
39 /** | 40 /** |
40 * Acts on an issue and dismisses it from the UI. | 41 * Acts on an issue and dismisses it from the UI. |
41 * Called when the user performs an action on an issue. | 42 * Called when the user performs an action on an issue. |
42 * | 43 * |
43 * @param {{detail: {id: string, actionType: number, helpPageId: number}}} | 44 * @param {{detail: {id: string, actionType: number, helpPageId: number}}} |
44 * data | 45 * data |
45 * Parameters in |data|.detail: | 46 * Parameters in |data|.detail: |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 function onCloseRouteClick(data) { | 80 function onCloseRouteClick(data) { |
80 media_router.browserApi.closeRoute(data.detail.route); | 81 media_router.browserApi.closeRoute(data.detail.route); |
81 } | 82 } |
82 | 83 |
83 return { | 84 return { |
84 initialize: initialize, | 85 initialize: initialize, |
85 }; | 86 }; |
86 }); | 87 }); |
87 | 88 |
88 window.addEventListener('load', media_router.initialize); | 89 window.addEventListener('load', media_router.initialize); |
OLD | NEW |