OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 /** @suppress {duplicate} */ | 7 /** @suppress {duplicate} */ |
8 var remoting = remoting || {}; | 8 var remoting = remoting || {}; |
9 | 9 |
10 /** @constructor */ | 10 /** @constructor */ |
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
235 * @param {function(remoting.HostController.AsyncResult):void} callback | 235 * @param {function(remoting.HostController.AsyncResult):void} callback |
236 * Callback to be called when finished. | 236 * Callback to be called when finished. |
237 * @return {void} Nothing. | 237 * @return {void} Nothing. |
238 */ | 238 */ |
239 remoting.HostController.prototype.stop = function(callback) { | 239 remoting.HostController.prototype.stop = function(callback) { |
240 /** @type {remoting.HostController} */ | 240 /** @type {remoting.HostController} */ |
241 var that = this; | 241 var that = this; |
242 | 242 |
243 /** @param {remoting.HostController.AsyncResult} result */ | 243 /** @param {remoting.HostController.AsyncResult} result */ |
244 function onStopped(result) { | 244 function onStopped(result) { |
245 if (that.localHost && that.localHost.hostId) { | 245 if (result == remoting.HostController.AsyncResult.OK && |
| 246 that.localHost && that.localHost.hostId) { |
246 remoting.HostList.unregisterHostById(that.localHost.hostId); | 247 remoting.HostList.unregisterHostById(that.localHost.hostId); |
247 } | 248 } |
248 callback(result); | 249 callback(result); |
249 }; | 250 }; |
250 this.plugin_.stopDaemon(onStopped); | 251 this.plugin_.stopDaemon(onStopped); |
251 }; | 252 }; |
252 | 253 |
253 /** | 254 /** |
254 * Parse a stringified host configuration and return it as a dictionary if it | 255 * Parse a stringified host configuration and return it as a dictionary if it |
255 * is well-formed and contains both host_id and xmpp_login keys. null is | 256 * is well-formed and contains both host_id and xmpp_login keys. null is |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
362 try { | 363 try { |
363 this.plugin_.getDaemonConfig(onConfig); | 364 this.plugin_.getDaemonConfig(onConfig); |
364 } catch (err) { | 365 } catch (err) { |
365 this.setHost(null); | 366 this.setHost(null); |
366 onDone(); | 367 onDone(); |
367 } | 368 } |
368 }; | 369 }; |
369 | 370 |
370 /** @type {remoting.HostController} */ | 371 /** @type {remoting.HostController} */ |
371 remoting.hostController = null; | 372 remoting.hostController = null; |
OLD | NEW |