| 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.DaemonPlugin = function() { | 11 remoting.DaemonPlugin = 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 }; | 17 }; |
| 18 | 18 |
| 19 // Note that the values in this enum are copied from daemon_controller.h and | 19 // Note that the values in this enum are copied from daemon_controller.h and |
| 20 // must be kept in sync. | 20 // must be kept in sync. |
| 21 /** @enum {number} */ | 21 /** @enum {number} */ |
| 22 remoting.DaemonPlugin.State = { | 22 remoting.DaemonPlugin.State = { |
| 23 NOT_IMPLEMENTED: -1, | 23 NOT_IMPLEMENTED: -1, |
| 24 NOT_INSTALLED: 0, | 24 NOT_INSTALLED: 0, |
| 25 STOPPED: 1, | 25 INSTALLING: 1, |
| 26 STARTED: 2, | 26 STOPPED: 2, |
| 27 START_FAILED: 3, | 27 STARTING: 3, |
| 28 UNKNOWN: 4 | 28 STARTED: 4, |
| 29 STOPPING: 5, |
| 30 START_FAILED: 6, |
| 31 UNKNOWN: 7 |
| 29 }; | 32 }; |
| 30 | 33 |
| 31 /** @return {remoting.DaemonPlugin.State} The current state of the daemon. */ | 34 /** @return {remoting.DaemonPlugin.State} The current state of the daemon. */ |
| 32 remoting.DaemonPlugin.prototype.state = function() { | 35 remoting.DaemonPlugin.prototype.state = function() { |
| 33 try { | 36 try { |
| 34 return this.plugin_.daemonState; | 37 return this.plugin_.daemonState; |
| 35 } catch (err) { | 38 } catch (err) { |
| 36 // If the plug-in can't be instantiated, for example on ChromeOS, then | 39 // If the plug-in can't be instantiated, for example on ChromeOS, then |
| 37 // return something sensible. | 40 // return something sensible. |
| 38 return remoting.DaemonPlugin.State.NOT_IMPLEMENTED; | 41 return remoting.DaemonPlugin.State.NOT_IMPLEMENTED; |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 /** | 109 /** |
| 107 * @param {string} pin The new PIN for the daemon process. | 110 * @param {string} pin The new PIN for the daemon process. |
| 108 * @return {void} Nothing. | 111 * @return {void} Nothing. |
| 109 */ | 112 */ |
| 110 remoting.DaemonPlugin.prototype.setPin = function(pin) { | 113 remoting.DaemonPlugin.prototype.setPin = function(pin) { |
| 111 this.plugin_.setDaemonPin(pin); | 114 this.plugin_.setDaemonPin(pin); |
| 112 }; | 115 }; |
| 113 | 116 |
| 114 /** @type {remoting.DaemonPlugin} */ | 117 /** @type {remoting.DaemonPlugin} */ |
| 115 remoting.daemonPlugin = null; | 118 remoting.daemonPlugin = null; |
| OLD | NEW |