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

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

Issue 1140823003: Redesign cast-mode-picker UX and switch to core/paper elements. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 years, 7 months 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 // TODO(apacible): Add chrome.send call when browser WebUI message 20 // TODO(apacible): Add chrome.send call when browser WebUI message
21 // handler is implemented. 21 // handler is implemented.
22 22
23 container = $('media-router-container'); 23 container = $('media-router-container');
24 media_router.ui.setContainer(container); 24 media_router.ui.setContainer(container);
25 25
26 container.addEventListener('cast-mode-click', onCastModeClick);
27 container.addEventListener('close-button-click', onCloseDialogClick); 26 container.addEventListener('close-button-click', onCloseDialogClick);
28 container.addEventListener('close-route-click', onCloseRouteClick); 27 container.addEventListener('close-route-click', onCloseRouteClick);
29 container.addEventListener('create-route', onCreateRoute); 28 container.addEventListener('create-route', onCreateRoute);
30 container.addEventListener('issue-action-click', onIssueActionClick); 29 container.addEventListener('issue-action-click', onIssueActionClick);
31 } 30 }
32 31
33 /** 32 /**
34 * Changes the UI, such as the the header text, in response to a cast mode
35 * change.
36 * Called when the user selects a cast mode.
37 *
38 * @param {{detail: {headerText: string}}} data
39 * Parameters in |data|.detail:
40 * headerText - the new header text corresponding to the selected
41 * cast mode.
42 */
43 function onCastModeClick(data) {
44 container.headerText = data.detail.headerText;
45 }
46
47 /**
48 * Closes the dialog. 33 * Closes the dialog.
49 * Called when the user clicks the close button on the dialog. 34 * Called when the user clicks the close button on the dialog.
50 */ 35 */
51 function onCloseDialogClick() { 36 function onCloseDialogClick() {
52 media_router.browserApi.closeDialog(); 37 media_router.browserApi.closeDialog();
53 } 38 }
54 39
55 /** 40 /**
56 * Acts on an issue and dismisses it from the UI. 41 * Acts on an issue and dismisses it from the UI.
57 * Called when the user performs an action on an issue. 42 * Called when the user performs an action on an issue.
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 function onCloseRouteClick(data) { 79 function onCloseRouteClick(data) {
95 media_router.browserApi.closeRoute(data.detail.route); 80 media_router.browserApi.closeRoute(data.detail.route);
96 } 81 }
97 82
98 return { 83 return {
99 initialize: initialize, 84 initialize: initialize,
100 }; 85 };
101 }); 86 });
102 87
103 window.addEventListener('polymer-ready', media_router.initialize); 88 window.addEventListener('polymer-ready', media_router.initialize);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698