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 */ |
11 remoting.HostController = function() { | 11 remoting.HostController = function() { |
12 /** @type {remoting.HostPlugin} @private */ | 12 /** @type {remoting.HostPlugin} @private */ |
13 this.plugin_ = remoting.HostSession.createPlugin(); | 13 this.plugin_ = remoting.HostSession.createPlugin(); |
14 /** @type {HTMLElement} @private */ | 14 /** @type {HTMLElement} @private */ |
15 this.container_ = document.getElementById('daemon-plugin-container'); | 15 this.container_ = document.getElementById('daemon-plugin-container'); |
16 this.container_.appendChild(this.plugin_); | 16 this.container_.appendChild(this.plugin_); |
17 /** @type {remoting.Host?} */ | 17 /** @type {remoting.Host?} */ |
18 this.localHost = null; | 18 this.localHost = null; |
19 /** @param {string} version */ | 19 /** @param {string} version */ |
20 var printVersion = function(version) { | 20 var printVersion = function(version) { |
21 if (version == '') { | 21 if (version == '') { |
22 console.log('Host not installed.'); | 22 console.log('Host not installed.'); |
23 } else { | 23 } else { |
24 console.log('Host version:', version); | 24 console.log('Host version:', version); |
25 } | 25 } |
26 }; | 26 }; |
27 this.plugin_.getDaemonVersion(printVersion); | 27 try { |
28 this.plugin_.getDaemonVersion(printVersion); | |
29 } catch (err) { | |
30 console.log('Host version not available.'); | |
Jamie
2012/05/18 01:13:35
Optional: I think I'd just call printVersion('')
| |
31 } | |
28 }; | 32 }; |
29 | 33 |
30 // Note that the values in the enums below are copied from | 34 // Note that the values in the enums below are copied from |
31 // daemon_controller.h and must be kept in sync. | 35 // daemon_controller.h and must be kept in sync. |
32 /** @enum {number} */ | 36 /** @enum {number} */ |
33 remoting.HostController.State = { | 37 remoting.HostController.State = { |
34 NOT_IMPLEMENTED: -1, | 38 NOT_IMPLEMENTED: -1, |
35 NOT_INSTALLED: 0, | 39 NOT_INSTALLED: 0, |
36 INSTALLING: 1, | 40 INSTALLING: 1, |
37 STOPPED: 2, | 41 STOPPED: 2, |
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
357 try { | 361 try { |
358 this.plugin_.getDaemonConfig(onConfig); | 362 this.plugin_.getDaemonConfig(onConfig); |
359 } catch (err) { | 363 } catch (err) { |
360 this.setHost(null); | 364 this.setHost(null); |
361 onDone(); | 365 onDone(); |
362 } | 366 } |
363 }; | 367 }; |
364 | 368 |
365 /** @type {remoting.HostController} */ | 369 /** @type {remoting.HostController} */ |
366 remoting.hostController = null; | 370 remoting.hostController = null; |
OLD | NEW |