[Eraser strings] Remove unused Supervised User infobar and corresponding strings
[chromium-blink-merge.git] / chrome / browser / resources / media_router / media_router_ui_interface.js
blobf38be61ad88a95e67644d8d3cce53d97f701cb10
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
3 // found in the LICENSE file.
5 // API invoked by the browser MediaRouterWebUIMessageHandler to communicate
6 // with this UI.
7 cr.define('media_router.ui', function() {
8 'use strict';
10 // The media-router-container element.
11 var container = null;
13 /**
14 * Handles response of previous create route attempt.
16 * @param {string} sinkId The ID of the sink to which the Media Route was
17 * creating a route.
18 * @param {?media_router.Route} route The newly create route to the sink
19 * if route creation succeeded; null otherwise
21 function onCreateRouteResponseReceived(sinkId, route) {
22 container.onCreateRouteResponseReceived(sinkId, route);
25 /**
26 * Sets the cast mode list.
28 * @param {!Array<!media_router.CastMode>} castModeList
30 function setCastModeList(castModeList) {
31 container.castModeList = castModeList;
34 /**
35 * Sets |container|.
37 * @param {!MediaRouterContainerElement} mediaRouterContainer
39 function setContainer(mediaRouterContainer) {
40 container = mediaRouterContainer;
43 /**
44 * Populates the WebUI with data obtained from Media Router.
46 * @param {headerText: string,
47 * headerTextTooltip: string,
48 * sinks: !Array<!media_router.Sink>,
49 * routes: !Array<!media_router.Route>,
50 * castModes: !Array<!media_router.CastMode>} data
51 * Parameters in data:
52 * headerText - text to be displayed in the header of the WebUI.
53 * headerTextTooltip - tooltip to be displayed for the header of the WebUI.
54 * sinks - list of sinks to be displayed.
55 * routes - list of routes that are associated with the sinks.
56 * castModes - list of available cast modes.
57 * routeProviderExtensionId - the ID of the media route provider extension.
59 function setInitialData(data) {
60 container.headerText = data['headerText'];
61 container.headerTextTooltip = data['headerTextTooltip'];
62 container.sinkList = data['sinks'];
63 container.routeList = data['routes'];
64 container.castModeList = data['castModes'];
65 container.routeProviderExtensionId = data['routeProviderExtensionId'];
68 /**
69 * Sets current issue to |issue|, or clears the current issue if |issue| is
70 * null.
72 * @param {?media_router.Issue} issue
74 function setIssue(issue) {
75 container.issue = issue;
78 /**
79 * Sets the list of currently active routes.
81 * @param {!Array<!media_router.Route>} routeList
83 function setRouteList(routeList) {
84 container.routeList = routeList;
87 /**
88 * Sets the list of discovered sinks.
90 * @param {!Array<!media_router.Sink>} sinkList
92 function setSinkList(sinkList) {
93 container.sinkList = sinkList;
96 return {
97 onCreateRouteResponseReceived: onCreateRouteResponseReceived,
98 setCastModeList: setCastModeList,
99 setContainer: setContainer,
100 setInitialData: setInitialData,
101 setIssue: setIssue,
102 setRouteList: setRouteList,
103 setSinkList: setSinkList,
107 // API invoked by this UI to communicate with the browser WebUI message handler.
108 cr.define('media_router.browserApi', function() {
109 'use strict';
112 * Acts on the given issue.
114 * @param {string} issueId
115 * @param {number} actionType Type of action that the user clicked.
116 * @param {?number} helpPageId The numeric help center ID.
118 function actOnIssue(issueId, actionType, helpPageId) {
119 chrome.send('actOnIssue', [{issueId: issueId, actionType: actionType,
120 helpPageId: helpPageId}]);
124 * Closes the dialog.
126 function closeDialog() {
127 chrome.send('closeDialog');
131 * Closes the given route.
133 * @param {!media_router.Route} route
135 function closeRoute(route) {
136 chrome.send('closeRoute', [{routeId: route.id}]);
140 * Requests data to initialize the WebUI with.
141 * The data will be returned via media_router.ui.setInitialData.
143 function requestInitialData() {
144 chrome.send('requestInitialData');
148 * Requests that a media route be started with the given sink.
150 * @param {string} sinkId The sink ID.
151 * @param {number} selectedCastMode The value of the cast mode the user
152 * selected, or -1 if the user has not explicitly selected a mode.
154 function requestRoute(sinkId, selectedCastMode) {
155 chrome.send('requestRoute',
156 [{sinkId: sinkId, selectedCastMode: selectedCastMode}]);
159 return {
160 actOnIssue: actOnIssue,
161 closeDialog: closeDialog,
162 closeRoute: closeRoute,
163 requestInitialData: requestInitialData,
164 requestRoute: requestRoute,