OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 'use strict'; | 5 'use strict'; |
6 | 6 |
7 /** | 7 /** |
| 8 * @type {string} The app id (from the webstore) for this application. |
| 9 */ |
| 10 var appId = ''; |
| 11 |
| 12 /** |
8 * @type {string} The host id corresponding to the user's VM. The @pending | 13 * @type {string} The host id corresponding to the user's VM. The @pending |
9 * place-holder instructs the Orchestrator to abandon any pending host, | 14 * place-holder instructs the Orchestrator to abandon any pending host, |
10 * and is used if no host id is provided by the main window. | 15 * and is used if no host id is provided by the main window. |
11 */ | 16 */ |
12 var hostId = '@pending'; | 17 var hostId = '@pending'; |
13 | 18 |
14 /** | 19 /** |
15 * @type {string} The network stats at the time the feedback consent dialog | 20 * @type {string} The network stats at the time the feedback consent dialog |
16 * was shown. | 21 * was shown. |
17 */ | 22 */ |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 }; | 138 }; |
134 if (!token) { | 139 if (!token) { |
135 onUserInfo('unknown', 'unknown'); | 140 onUserInfo('unknown', 'unknown'); |
136 } else { | 141 } else { |
137 if (abandonHost == 'yes') { | 142 if (abandonHost == 'yes') { |
138 var body = { | 143 var body = { |
139 'abandonHost': 'true', | 144 'abandonHost': 'true', |
140 'crashServiceReportId': crashServiceReportId | 145 'crashServiceReportId': crashServiceReportId |
141 }; | 146 }; |
142 var uri = remoting.settings.APP_REMOTING_API_BASE_URL + | 147 var uri = remoting.settings.APP_REMOTING_API_BASE_URL + |
143 '/applications/' + remoting.settings.getAppRemotingApplicationId() + | 148 '/applications/' + appId + |
144 '/hosts/' + hostId + | 149 '/hosts/' + hostId + |
145 '/reportIssue'; | 150 '/reportIssue'; |
146 var onDone = function(/** !remoting.Xhr.Response */ response) { | 151 var onDone = function(/** !remoting.Xhr.Response */ response) { |
147 if (response.status >= 200 && response.status < 300) { | 152 if (response.status >= 200 && response.status < 300) { |
148 getUserInfo(); | 153 getUserInfo(); |
149 } else { | 154 } else { |
150 showError(); | 155 showError(); |
151 } | 156 } |
152 }; | 157 }; |
153 new remoting.Xhr({ | 158 new remoting.Xhr({ |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
243 } | 248 } |
244 | 249 |
245 /** @param {Event} event */ | 250 /** @param {Event} event */ |
246 function onWindowMessage(event) { | 251 function onWindowMessage(event) { |
247 applicationWindow = event.source; | 252 applicationWindow = event.source; |
248 var method = /** @type {string} */ (event.data['method']); | 253 var method = /** @type {string} */ (event.data['method']); |
249 if (method == 'init') { | 254 if (method == 'init') { |
250 if (event.data['hostId']) { | 255 if (event.data['hostId']) { |
251 hostId = /** @type {string} */ (event.data['hostId']); | 256 hostId = /** @type {string} */ (event.data['hostId']); |
252 } | 257 } |
| 258 appId = /** @type {string} */ (event.data['appId']); |
253 connectionStats = /** @type {string} */ (event.data['connectionStats']); | 259 connectionStats = /** @type {string} */ (event.data['connectionStats']); |
254 sessionId = /** @type {string} */ (event.data['sessionId']); | 260 sessionId = /** @type {string} */ (event.data['sessionId']); |
255 } | 261 } |
256 }; | 262 }; |
257 | 263 |
258 window.addEventListener('load', onLoad, false); | 264 window.addEventListener('load', onLoad, false); |
OLD | NEW |