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 /** @suppress {duplicate} */ | 5 /** @suppress {duplicate} */ |
6 var remoting = remoting || {}; | 6 var remoting = remoting || {}; |
7 | 7 |
8 /** | 8 /** |
9 * Type definition for the RunApplicationResponse returned by the API. | 9 * Type definition for the RunApplicationResponse returned by the API. |
10 * @typedef {{ | 10 * @typedef {{ |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
173 } | 173 } |
174 }; | 174 }; |
175 | 175 |
176 /** | 176 /** |
177 * @param {remoting.Error} error | 177 * @param {remoting.Error} error |
178 */ | 178 */ |
179 remoting.AppRemotingActivity.prototype.onDisconnected = function(error) { | 179 remoting.AppRemotingActivity.prototype.onDisconnected = function(error) { |
180 if (error.isNone()) { | 180 if (error.isNone()) { |
181 chrome.app.window.current().close(); | 181 chrome.app.window.current().close(); |
182 } else { | 182 } else { |
183 this.showErrorMessage_(error); | 183 this.onConnectionDropped_(); |
184 } | 184 } |
185 this.cleanup_(); | |
186 }; | 185 }; |
187 | 186 |
188 /** | 187 /** |
189 * @param {!remoting.Error} error | 188 * @param {!remoting.Error} error |
190 */ | 189 */ |
191 remoting.AppRemotingActivity.prototype.onConnectionFailed = function(error) { | 190 remoting.AppRemotingActivity.prototype.onConnectionFailed = function(error) { |
192 remoting.LoadingWindow.close(); | 191 remoting.LoadingWindow.close(); |
193 this.showErrorMessage_(error); | 192 this.showErrorMessage_(error); |
194 this.cleanup_(); | 193 this.cleanup_(); |
195 }; | 194 }; |
196 | 195 |
196 /** @private */ | |
197 remoting.AppRemotingActivity.prototype.onConnectionDropped_ = function() { | |
Jamie
2015/05/20 02:20:37
I think there's value in passing the error into he
kelvinp
2015/05/20 18:13:00
The error is already logged in the earlier stack (
| |
198 var rootElement = /** @type {HTMLDialogElement} */ ( | |
199 document.getElementById('connection-dropped-dialog')); | |
200 var dialog = new remoting.Html5ModalDialog( | |
201 rootElement, rootElement.querySelector('.restart-button'), | |
202 rootElement.querySelector('.close-button')); | |
203 var Result = remoting.MessageDialog.Result; | |
Jamie
2015/05/20 02:20:37
I'm surprised that this assignment works as far as
kelvinp
2015/05/20 18:12:59
Done.
| |
204 var that = this; | |
205 | |
206 dialog.show().then(function(/** Result */ result) { | |
207 if (result === Result.PRIMARY) { | |
208 // Hide the desktop window before tearing down the plugin. | |
Jamie
2015/05/20 02:20:37
This comment doesn't seem to be accurate.
kelvinp
2015/05/20 18:13:00
Maybe I need to phrase it better. By calling setD
| |
209 remoting.windowShape.setDesktopRects([]); | |
210 that.cleanup_(); | |
211 that.start(); | |
212 } else { | |
213 chrome.app.window.current().close(); | |
214 } | |
215 }); | |
216 }; | |
217 | |
197 /** | 218 /** |
198 * @param {!remoting.Error} error The error to be localized and displayed. | 219 * @param {!remoting.Error} error The error to be localized and displayed. |
199 * @private | 220 * @private |
200 */ | 221 */ |
201 remoting.AppRemotingActivity.prototype.showErrorMessage_ = function(error) { | 222 remoting.AppRemotingActivity.prototype.showErrorMessage_ = function(error) { |
202 console.error('Connection failed: ' + error.toString()); | 223 console.error('Connection failed: ' + error.toString()); |
203 remoting.MessageWindow.showErrorMessage( | 224 remoting.MessageWindow.showErrorMessage( |
204 remoting.app.getApplicationName(), | 225 remoting.app.getApplicationName(), |
205 chrome.i18n.getMessage(error.getTag())); | 226 chrome.i18n.getMessage(error.getTag())); |
206 }; | 227 }; |
207 | 228 |
208 })(); | 229 })(); |
OLD | NEW |