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

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

Issue 1423683002: [Media Router] Add P1 UMA metrics for Media Router. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix JS. 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', onCloseDialogClick); 25 container.addEventListener('close-button-click', onCloseDialogClick);
26 container.addEventListener('close-route-click', onCloseRouteClick); 26 container.addEventListener('close-route-click', onCloseRouteClick);
27 container.addEventListener('create-route', onCreateRoute); 27 container.addEventListener('create-route', onCreateRoute);
28 container.addEventListener('issue-action-click', onIssueActionClick); 28 container.addEventListener('issue-action-click', onIssueActionClick);
29 container.addEventListener('report-sink-count', onSinkCountReported);
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 onCloseDialogClick() {
36 media_router.browserApi.closeDialog(); 37 media_router.browserApi.closeDialog();
37 } 38 }
38 39
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 * Called when the user requests to stop a media route. 74 * Called when the user requests to stop a media route.
74 * 75 *
75 * @param {{detail: {route: string}}} data 76 * @param {{detail: {route: string}}} data
76 * Parameters in |data|.detail: 77 * Parameters in |data|.detail:
77 * route - route ID. 78 * route - route ID.
78 */ 79 */
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
84 /**
85 * Reports the current sink count.
86 * Called 3 seconds after the dialog is initially opened.
87 *
88 * @param {{detail: {sinkCount: number}}} data
89 * Parameters in |data|.detail:
90 * sinkCount - the number of sinks.
91 */
92 function onSinkCountReported(data) {
93 media_router.browserApi.reportSinkCount(data.detail.sinkCount);
94 }
95
83 return { 96 return {
84 initialize: initialize, 97 initialize: initialize,
85 }; 98 };
86 }); 99 });
87 100
88 window.addEventListener('load', media_router.initialize); 101 window.addEventListener('load', media_router.initialize);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698