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