Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(391)

Side by Side Diff: chrome/browser/resources/media_router/media_router.js

Issue 1415103006: Non-Local Join for Media Router and Presentation API (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Auto-Formatting Fixes Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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', onCloseDialogEvent); 25 container.addEventListener('close-button-click', onCloseDialogEvent);
26 container.addEventListener('close-dialog', onCloseDialogEvent); 26 container.addEventListener('close-dialog', onCloseDialogEvent);
27 container.addEventListener('close-route-click', onCloseRouteClick); 27 container.addEventListener('close-route-click', onCloseRouteClick);
28 container.addEventListener('join-route-click', onJoinRouteClick);
28 container.addEventListener('create-route', onCreateRoute); 29 container.addEventListener('create-route', onCreateRoute);
29 container.addEventListener('issue-action-click', onIssueActionClick); 30 container.addEventListener('issue-action-click', onIssueActionClick);
30 container.addEventListener('report-sink-count', onSinkCountReported); 31 container.addEventListener('report-sink-count', onSinkCountReported);
31 } 32 }
32 33
33 /** 34 /**
34 * Closes the dialog. 35 * Closes the dialog.
35 * Called when the user clicks the close button on the dialog. 36 * Called when the user clicks the close button on the dialog.
36 */ 37 */
37 function onCloseDialogEvent() { 38 function onCloseDialogEvent() {
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 * 77 *
77 * @param {{detail: {route: string}}} data 78 * @param {{detail: {route: string}}} data
78 * Parameters in |data|.detail: 79 * Parameters in |data|.detail:
79 * route - route ID. 80 * route - route ID.
80 */ 81 */
81 function onCloseRouteClick(data) { 82 function onCloseRouteClick(data) {
82 media_router.browserApi.closeRoute(data.detail.route); 83 media_router.browserApi.closeRoute(data.detail.route);
83 } 84 }
84 85
85 /** 86 /**
87 * Joins a route.
88 * Called when the user requests to join a media route.
89 *
90 * @param {{detail: {route: string}}} data
91 * Parameters in |data|.detail:
92 * route - route ID.
93 */
94 function onJoinRouteClick(data) {
95 console.log('media router ui join clicked: ' + JSON.stringify(data.detail));
mark a. foltz 2015/11/09 19:12:31 This probably should be removed before submitting.
matt.boetger 2015/11/09 19:24:35 Agreed. This was just for debugging.
96 media_router.browserApi.joinRoute(data.detail.route);
97 }
98
99 /**
86 * Reports the current sink count. 100 * Reports the current sink count.
87 * Called 3 seconds after the dialog is initially opened. 101 * Called 3 seconds after the dialog is initially opened.
88 * 102 *
89 * @param {{detail: {sinkCount: number}}} data 103 * @param {{detail: {sinkCount: number}}} data
90 * Parameters in |data|.detail: 104 * Parameters in |data|.detail:
91 * sinkCount - the number of sinks. 105 * sinkCount - the number of sinks.
92 */ 106 */
93 function onSinkCountReported(data) { 107 function onSinkCountReported(data) {
94 media_router.browserApi.reportSinkCount(data.detail.sinkCount); 108 media_router.browserApi.reportSinkCount(data.detail.sinkCount);
95 } 109 }
96 110
97 return { 111 return {
98 initialize: initialize, 112 initialize: initialize,
99 }; 113 };
100 }); 114 });
101 115
102 window.addEventListener('load', media_router.initialize); 116 window.addEventListener('load', media_router.initialize);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698