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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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, |
58 * showFirstRunFlowCloudPref: boolean}} data | |
imcheng
2016/01/25 19:21:06
Should this be {boolean|undefined}? Another way is
apacible
2016/01/26 01:12:56
Done. Set to false in Chromium builds.
| |
58 * Parameters in data: | 59 * Parameters in data: |
59 * deviceMissingUrl - url to be opened on "Device missing?" clicked. | 60 * deviceMissingUrl - url to be opened on "Device missing?" clicked. |
60 * sinks - list of sinks to be displayed. | 61 * sinks - list of sinks to be displayed. |
61 * routes - list of routes that are associated with the sinks. | 62 * routes - list of routes that are associated with the sinks. |
62 * castModes - list of available cast modes. | 63 * castModes - list of available cast modes. |
63 * wasFirstRunFlowAcknowledged - true if first run flow was previously | 64 * wasFirstRunFlowAcknowledged - true if first run flow was previously |
64 * acknowledged by user. | 65 * acknowledged by user. |
66 * showFirstRunFlowCloudPref - true if the cloud pref option should be | |
67 * shown. | |
65 */ | 68 */ |
66 function setInitialData(data) { | 69 function setInitialData(data) { |
67 container.deviceMissingUrl = data['deviceMissingUrl']; | 70 container.deviceMissingUrl = data['deviceMissingUrl']; |
68 container.castModeList = data['castModes']; | 71 container.castModeList = data['castModes']; |
69 container.allSinks = data['sinks']; | 72 container.allSinks = data['sinks']; |
70 container.routeList = data['routes']; | 73 container.routeList = data['routes']; |
71 container.showFirstRunFlow = !data['wasFirstRunFlowAcknowledged']; | 74 container.showFirstRunFlow = !data['wasFirstRunFlowAcknowledged']; |
75 container.showFirstRunFlowCloudPref = | |
76 data['showFirstRunFlowCloudPref']; | |
imcheng
2016/01/25 19:21:06
should this be "data['showFirstRunFlowCloudPref']
apacible
2016/01/26 01:12:56
See above comment.
| |
72 container.maybeShowRouteDetailsOnOpen(); | 77 container.maybeShowRouteDetailsOnOpen(); |
73 media_router.browserApi.onInitialDataReceived(); | 78 media_router.browserApi.onInitialDataReceived(); |
74 } | 79 } |
75 | 80 |
76 /** | 81 /** |
77 * Sets current issue to |issue|, or clears the current issue if |issue| is | 82 * Sets current issue to |issue|, or clears the current issue if |issue| is |
78 * null. | 83 * null. |
79 * | 84 * |
80 * @param {?media_router.Issue} issue | 85 * @param {?media_router.Issue} issue |
81 */ | 86 */ |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
122 updateMaxHeight: updateMaxHeight, | 127 updateMaxHeight: updateMaxHeight, |
123 }; | 128 }; |
124 }); | 129 }); |
125 | 130 |
126 // API invoked by this UI to communicate with the browser WebUI message handler. | 131 // API invoked by this UI to communicate with the browser WebUI message handler. |
127 cr.define('media_router.browserApi', function() { | 132 cr.define('media_router.browserApi', function() { |
128 'use strict'; | 133 'use strict'; |
129 | 134 |
130 /** | 135 /** |
131 * Indicates that the user has acknowledged the first run flow. | 136 * Indicates that the user has acknowledged the first run flow. |
137 * | |
138 * @param {boolean} optedIntoCloudServices Whether or not the user opted into | |
139 * cloud services. | |
132 */ | 140 */ |
133 function acknowledgeFirstRunFlow() { | 141 function acknowledgeFirstRunFlow(optedIntoCloudServices) { |
134 chrome.send('acknowledgeFirstRunFlow'); | 142 chrome.send('acknowledgeFirstRunFlow', [optedIntoCloudServices]); |
135 } | 143 } |
136 | 144 |
137 /** | 145 /** |
138 * Acts on the given issue. | 146 * Acts on the given issue. |
139 * | 147 * |
140 * @param {string} issueId | 148 * @param {string} issueId |
141 * @param {number} actionType Type of action that the user clicked. | 149 * @param {number} actionType Type of action that the user clicked. |
142 * @param {?number} helpPageId The numeric help center ID. | 150 * @param {?number} helpPageId The numeric help center ID. |
143 */ | 151 */ |
144 function actOnIssue(issueId, actionType, helpPageId) { | 152 function actOnIssue(issueId, actionType, helpPageId) { |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
284 reportInitialState: reportInitialState, | 292 reportInitialState: reportInitialState, |
285 reportNavigateToView: reportNavigateToView, | 293 reportNavigateToView: reportNavigateToView, |
286 reportSelectedCastMode: reportSelectedCastMode, | 294 reportSelectedCastMode: reportSelectedCastMode, |
287 reportSinkCount: reportSinkCount, | 295 reportSinkCount: reportSinkCount, |
288 reportTimeToClickSink: reportTimeToClickSink, | 296 reportTimeToClickSink: reportTimeToClickSink, |
289 reportTimeToInitialActionClose: reportTimeToInitialActionClose, | 297 reportTimeToInitialActionClose: reportTimeToInitialActionClose, |
290 requestInitialData: requestInitialData, | 298 requestInitialData: requestInitialData, |
291 requestRoute: requestRoute, | 299 requestRoute: requestRoute, |
292 }; | 300 }; |
293 }); | 301 }); |
OLD | NEW |