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. |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 * | 43 * |
44 * @param {!MediaRouterContainerElement} mediaRouterContainer | 44 * @param {!MediaRouterContainerElement} mediaRouterContainer |
45 */ | 45 */ |
46 function setContainer(mediaRouterContainer) { | 46 function setContainer(mediaRouterContainer) { |
47 container = mediaRouterContainer; | 47 container = mediaRouterContainer; |
48 } | 48 } |
49 | 49 |
50 /** | 50 /** |
51 * Populates the WebUI with data obtained from Media Router. | 51 * Populates the WebUI with data obtained from Media Router. |
52 * | 52 * |
53 * @param {deviceMissingUrl: string, | 53 * @param {{deviceMissingUrl: string, |
54 * sinks: !Array<!media_router.Sink>, | 54 * sinks: !Array<!media_router.Sink>, |
55 * routes: !Array<!media_router.Route>, | 55 * routes: !Array<!media_router.Route>, |
56 * castModes: !Array<!media_router.CastMode>, | 56 * castModes: !Array<!media_router.CastMode>, |
57 * wasFirstRunFlowAcknowledged: boolean} data | 57 * wasFirstRunFlowAcknowledged: boolean}} data |
58 * Parameters in data: | 58 * Parameters in data: |
59 * deviceMissingUrl - url to be opened on "Device missing?" clicked. | 59 * deviceMissingUrl - url to be opened on "Device missing?" clicked. |
60 * sinks - list of sinks to be displayed. | 60 * sinks - list of sinks to be displayed. |
61 * routes - list of routes that are associated with the sinks. | 61 * routes - list of routes that are associated with the sinks. |
62 * castModes - list of available cast modes. | 62 * castModes - list of available cast modes. |
| 63 * wasFirstRunFlowAcknowledged - true if first run flow was previously |
| 64 * acknowledged by user. |
63 */ | 65 */ |
64 function setInitialData(data) { | 66 function setInitialData(data) { |
65 container.deviceMissingUrl = data['deviceMissingUrl']; | 67 container.deviceMissingUrl = data['deviceMissingUrl']; |
66 container.castModeList = data['castModes']; | 68 container.castModeList = data['castModes']; |
67 container.allSinks = data['sinks']; | 69 container.allSinks = data['sinks']; |
68 container.routeList = data['routes']; | 70 container.routeList = data['routes']; |
69 container.showFirstRunFlow = !data['wasFirstRunFlowAcknowledged']; | 71 container.showFirstRunFlow = !data['wasFirstRunFlowAcknowledged']; |
70 container.maybeShowRouteDetailsOnOpen(); | 72 container.maybeShowRouteDetailsOnOpen(); |
71 media_router.browserApi.onInitialDataReceived(); | 73 media_router.browserApi.onInitialDataReceived(); |
72 } | 74 } |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 | 180 |
179 /** | 181 /** |
180 * Reports the index of the selected sink. | 182 * Reports the index of the selected sink. |
181 * | 183 * |
182 * @param {number} sinkIndex | 184 * @param {number} sinkIndex |
183 */ | 185 */ |
184 function reportClickedSinkIndex(sinkIndex) { | 186 function reportClickedSinkIndex(sinkIndex) { |
185 chrome.send('reportClickedSinkIndex', [sinkIndex]); | 187 chrome.send('reportClickedSinkIndex', [sinkIndex]); |
186 } | 188 } |
187 | 189 |
188 /* | 190 /** |
189 * Reports the initial dialog view. | 191 * Reports the initial dialog view. |
190 * | 192 * |
191 * @param {string} view | 193 * @param {string} view |
192 */ | 194 */ |
193 function reportInitialState(view) { | 195 function reportInitialState(view) { |
194 chrome.send('reportInitialState', [view]); | 196 chrome.send('reportInitialState', [view]); |
195 } | 197 } |
196 | 198 |
197 /** | 199 /** |
198 * Reports the initial action the user took. | 200 * Reports the initial action the user took. |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
282 reportInitialState: reportInitialState, | 284 reportInitialState: reportInitialState, |
283 reportNavigateToView: reportNavigateToView, | 285 reportNavigateToView: reportNavigateToView, |
284 reportSelectedCastMode: reportSelectedCastMode, | 286 reportSelectedCastMode: reportSelectedCastMode, |
285 reportSinkCount: reportSinkCount, | 287 reportSinkCount: reportSinkCount, |
286 reportTimeToClickSink: reportTimeToClickSink, | 288 reportTimeToClickSink: reportTimeToClickSink, |
287 reportTimeToInitialActionClose: reportTimeToInitialActionClose, | 289 reportTimeToInitialActionClose: reportTimeToInitialActionClose, |
288 requestInitialData: requestInitialData, | 290 requestInitialData: requestInitialData, |
289 requestRoute: requestRoute, | 291 requestRoute: requestRoute, |
290 }; | 292 }; |
291 }); | 293 }); |
OLD | NEW |