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 // API invoked by the browser MediaRouterWebUIMessageHandler to communicate | 5 // API invoked by the browser MediaRouterWebUIMessageHandler to communicate |
6 // with this UI. | 6 // with this UI. |
7 cr.define('media_router.ui', function() { | 7 cr.define('media_router.ui', function() { |
8 'use strict'; | 8 'use strict'; |
9 | 9 |
10 // The media-router-container element. | 10 // The media-router-container element. |
11 var container = null; | 11 var container = null; |
12 | 12 |
13 /** | 13 /** |
14 * Adds a new route. | 14 * Handles response of previous create route attempt. |
15 * | 15 * |
16 * @param {!media_router.Route} route | 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 |
17 */ | 20 */ |
18 function addRoute(route) { | 21 function onCreateRouteResponseReceived(sinkId, route) { |
19 container.addRoute(route); | 22 container.onCreateRouteResponseReceived(sinkId, route); |
20 } | 23 } |
21 | 24 |
22 /** | 25 /** |
23 * Sets the cast mode list. | 26 * Sets the cast mode list. |
24 * | 27 * |
25 * @param {!Array<!media_router.CastMode>} castModeList | 28 * @param {!Array<!media_router.CastMode>} castModeList |
26 */ | 29 */ |
27 function setCastModeList(castModeList) { | 30 function setCastModeList(castModeList) { |
28 container.castModeList = castModeList; | 31 container.castModeList = castModeList; |
29 } | 32 } |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 /** | 87 /** |
85 * Sets the list of discovered sinks. | 88 * Sets the list of discovered sinks. |
86 * | 89 * |
87 * @param {!Array<!media_router.Sink>} sinkList | 90 * @param {!Array<!media_router.Sink>} sinkList |
88 */ | 91 */ |
89 function setSinkList(sinkList) { | 92 function setSinkList(sinkList) { |
90 container.sinkList = sinkList; | 93 container.sinkList = sinkList; |
91 } | 94 } |
92 | 95 |
93 return { | 96 return { |
94 addRoute: addRoute, | 97 onCreateRouteResponseReceived: onCreateRouteResponseReceived, |
95 setCastModeList: setCastModeList, | 98 setCastModeList: setCastModeList, |
96 setContainer: setContainer, | 99 setContainer: setContainer, |
97 setInitialData: setInitialData, | 100 setInitialData: setInitialData, |
98 setIssue: setIssue, | 101 setIssue: setIssue, |
99 setRouteList: setRouteList, | 102 setRouteList: setRouteList, |
100 setSinkList: setSinkList, | 103 setSinkList: setSinkList, |
101 }; | 104 }; |
102 }); | 105 }); |
103 | 106 |
104 // API invoked by this UI to communicate with the browser WebUI message handler. | 107 // API invoked by this UI to communicate with the browser WebUI message handler. |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 } | 157 } |
155 | 158 |
156 return { | 159 return { |
157 actOnIssue: actOnIssue, | 160 actOnIssue: actOnIssue, |
158 closeDialog: closeDialog, | 161 closeDialog: closeDialog, |
159 closeRoute: closeRoute, | 162 closeRoute: closeRoute, |
160 requestInitialData: requestInitialData, | 163 requestInitialData: requestInitialData, |
161 requestRoute: requestRoute, | 164 requestRoute: requestRoute, |
162 }; | 165 }; |
163 }); | 166 }); |
OLD | NEW |