| 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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 {{firstRunFlowCloudPrefLearnMoreUrl: string, | 53 * @param {{firstRunFlowCloudPrefLearnMoreUrl: string, |
| 54 * deviceMissingUrl: string, | 54 * deviceMissingUrl: string, |
| 55 * sinks: !Array<!media_router.Sink>, | 55 * sinks: !Array<!media_router.Sink>, |
| 56 * routes: !Array<!media_router.Route>, | 56 * routes: !Array<!media_router.Route>, |
| 57 * castModes: !Array<!media_router.CastMode>, | 57 * castModes: !Array<!media_router.CastMode>, |
| 58 * wasFirstRunFlowAcknowledged: boolean}} data | 58 * wasFirstRunFlowAcknowledged: boolean, |
| 59 * showFirstRunFlowCloudPref: boolean}} data |
| 59 * Parameters in data: | 60 * Parameters in data: |
| 60 * firstRunFlowCloudPrefLearnMoreUrl - url to open when the cloud services | 61 * firstRunFlowCloudPrefLearnMoreUrl - url to open when the cloud services |
| 61 * pref learn more link is clicked. | 62 * pref learn more link is clicked. |
| 62 * deviceMissingUrl - url to be opened on "Device missing?" clicked. | 63 * deviceMissingUrl - url to be opened on "Device missing?" clicked. |
| 63 * sinks - list of sinks to be displayed. | 64 * sinks - list of sinks to be displayed. |
| 64 * routes - list of routes that are associated with the sinks. | 65 * routes - list of routes that are associated with the sinks. |
| 65 * castModes - list of available cast modes. | 66 * castModes - list of available cast modes. |
| 66 * wasFirstRunFlowAcknowledged - true if first run flow was previously | 67 * wasFirstRunFlowAcknowledged - true if first run flow was previously |
| 67 * acknowledged by user. | 68 * acknowledged by user. |
| 69 * showFirstRunFlowCloudPref - true if the cloud pref option should be |
| 70 * shown. |
| 68 */ | 71 */ |
| 69 function setInitialData(data) { | 72 function setInitialData(data) { |
| 70 container.firstRunFlowCloudPrefLearnMoreUrl = | 73 container.firstRunFlowCloudPrefLearnMoreUrl = |
| 71 data['firstRunFlowCloudPrefLearnMoreUrl']; | 74 data['firstRunFlowCloudPrefLearnMoreUrl']; |
| 72 container.deviceMissingUrl = data['deviceMissingUrl']; | 75 container.deviceMissingUrl = data['deviceMissingUrl']; |
| 73 container.castModeList = data['castModes']; | 76 container.castModeList = data['castModes']; |
| 74 container.allSinks = data['sinks']; | 77 container.allSinks = data['sinks']; |
| 75 container.routeList = data['routes']; | 78 container.routeList = data['routes']; |
| 76 container.showFirstRunFlow = !data['wasFirstRunFlowAcknowledged']; | 79 container.showFirstRunFlow = !data['wasFirstRunFlowAcknowledged']; |
| 80 container.showFirstRunFlowCloudPref = |
| 81 data['showFirstRunFlowCloudPref']; |
| 77 container.maybeShowRouteDetailsOnOpen(); | 82 container.maybeShowRouteDetailsOnOpen(); |
| 78 media_router.browserApi.onInitialDataReceived(); | 83 media_router.browserApi.onInitialDataReceived(); |
| 79 } | 84 } |
| 80 | 85 |
| 81 /** | 86 /** |
| 82 * Sets current issue to |issue|, or clears the current issue if |issue| is | 87 * Sets current issue to |issue|, or clears the current issue if |issue| is |
| 83 * null. | 88 * null. |
| 84 * | 89 * |
| 85 * @param {?media_router.Issue} issue | 90 * @param {?media_router.Issue} issue |
| 86 */ | 91 */ |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 updateMaxHeight: updateMaxHeight, | 132 updateMaxHeight: updateMaxHeight, |
| 128 }; | 133 }; |
| 129 }); | 134 }); |
| 130 | 135 |
| 131 // API invoked by this UI to communicate with the browser WebUI message handler. | 136 // API invoked by this UI to communicate with the browser WebUI message handler. |
| 132 cr.define('media_router.browserApi', function() { | 137 cr.define('media_router.browserApi', function() { |
| 133 'use strict'; | 138 'use strict'; |
| 134 | 139 |
| 135 /** | 140 /** |
| 136 * Indicates that the user has acknowledged the first run flow. | 141 * Indicates that the user has acknowledged the first run flow. |
| 142 * |
| 143 * @param {boolean} optedIntoCloudServices Whether or not the user opted into |
| 144 * cloud services. |
| 137 */ | 145 */ |
| 138 function acknowledgeFirstRunFlow() { | 146 function acknowledgeFirstRunFlow(optedIntoCloudServices) { |
| 139 chrome.send('acknowledgeFirstRunFlow'); | 147 chrome.send('acknowledgeFirstRunFlow', [optedIntoCloudServices]); |
| 140 } | 148 } |
| 141 | 149 |
| 142 /** | 150 /** |
| 143 * Acts on the given issue. | 151 * Acts on the given issue. |
| 144 * | 152 * |
| 145 * @param {string} issueId | 153 * @param {string} issueId |
| 146 * @param {number} actionType Type of action that the user clicked. | 154 * @param {number} actionType Type of action that the user clicked. |
| 147 * @param {?number} helpPageId The numeric help center ID. | 155 * @param {?number} helpPageId The numeric help center ID. |
| 148 */ | 156 */ |
| 149 function actOnIssue(issueId, actionType, helpPageId) { | 157 function actOnIssue(issueId, actionType, helpPageId) { |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 299 reportNavigateToView: reportNavigateToView, | 307 reportNavigateToView: reportNavigateToView, |
| 300 reportSelectedCastMode: reportSelectedCastMode, | 308 reportSelectedCastMode: reportSelectedCastMode, |
| 301 reportRouteCreation: reportRouteCreation, | 309 reportRouteCreation: reportRouteCreation, |
| 302 reportSinkCount: reportSinkCount, | 310 reportSinkCount: reportSinkCount, |
| 303 reportTimeToClickSink: reportTimeToClickSink, | 311 reportTimeToClickSink: reportTimeToClickSink, |
| 304 reportTimeToInitialActionClose: reportTimeToInitialActionClose, | 312 reportTimeToInitialActionClose: reportTimeToInitialActionClose, |
| 305 requestInitialData: requestInitialData, | 313 requestInitialData: requestInitialData, |
| 306 requestRoute: requestRoute, | 314 requestRoute: requestRoute, |
| 307 }; | 315 }; |
| 308 }); | 316 }); |
| OLD | NEW |