summaryrefslogtreecommitdiffstats
path: root/remoting/webapp/crd/js/host_controller.js
diff options
context:
space:
mode:
authorJamie Walch <jamiewalch@chromium.org>2015-06-10 15:22:10 -0700
committerJamie Walch <jamiewalch@chromium.org>2015-06-10 22:24:17 +0000
commit787c019e398cf0da6073ff60a687a0e47910159c (patch)
tree6676bd450689ad38a7d3db43709bb24c25b54e53 /remoting/webapp/crd/js/host_controller.js
parent65380f6680684c1265321ac696142c4c1d351389 (diff)
downloadchromium_src-787c019e398cf0da6073ff60a687a0e47910159c.zip
chromium_src-787c019e398cf0da6073ff60a687a0e47910159c.tar.gz
chromium_src-787c019e398cf0da6073ff60a687a0e47910159c.tar.bz2
Add more host-side connection state logging for IT2Me.
This CL adds INITIALIZING, CONNECTING, FAILED and CANCELED states to the host-side IT2Me connection set-up. It has the following components: * BufferedSignalStrategy: A new class to wrap an underlying SignalStrategy so that messages can be logged before the XMPP connection is established. Doing otherwise would slow down connections unnecessarily, but a consequence is that we aren't guaranteed that the new messages will actually be logged; still it's better than the previous situation. * Support for host-side logging in LogToServer. * Minimal refactoring to make the code that reads the local host version publicly callable. Note that some of this code, in particular the BufferedSignalStrategy class should go away if we implement logging using XHRs. BUG=497876 TBR=kelvinp@chromium.org Review URL: https://codereview.chromium.org/1176693002 Cr-Commit-Position: refs/heads/master@{#333771} (cherry picked from commit 9ea60d8ecacbccac0221c7f576ef19d6635de1cd) Review URL: https://codereview.chromium.org/1177033002. Cr-Commit-Position: refs/branch-heads/2403@{#271} Cr-Branched-From: f54b8097a9c45ed4ad308133d49f05325d6c5070-refs/heads/master@{#330231}
Diffstat (limited to 'remoting/webapp/crd/js/host_controller.js')
-rw-r--r--remoting/webapp/crd/js/host_controller.js50
1 files changed, 25 insertions, 25 deletions
diff --git a/remoting/webapp/crd/js/host_controller.js b/remoting/webapp/crd/js/host_controller.js
index a3ae6e6..cdc8dfc 100644
--- a/remoting/webapp/crd/js/host_controller.js
+++ b/remoting/webapp/crd/js/host_controller.js
@@ -9,7 +9,23 @@ var remoting = remoting || {};
/** @constructor */
remoting.HostController = function() {
- this.hostDaemonFacade_ = this.createDaemonFacade_();
+ /** @type {remoting.HostDaemonFacade} @private */
+ this.hostDaemonFacade_ = new remoting.HostDaemonFacade();
+
+ /** @param {string} version */
+ var printVersion = function(version) {
+ if (version == '') {
+ console.log('Host not installed.');
+ } else {
+ console.log('Host version: ' + version);
+ }
+ };
+
+ this.getLocalHostVersion()
+ .then(printVersion)
+ .catch(function() {
+ console.log('Host version not available.');
+ });
};
// The values in the enums below are duplicated in daemon_controller.h except
@@ -56,30 +72,6 @@ remoting.HostController.AsyncResult.fromString = function(result) {
}
/**
- * @return {remoting.HostDaemonFacade}
- * @private
- */
-remoting.HostController.prototype.createDaemonFacade_ = function() {
- /** @type {remoting.HostDaemonFacade} @private */
- var hostDaemonFacade = new remoting.HostDaemonFacade();
-
- /** @param {string} version */
- var printVersion = function(version) {
- if (version == '') {
- console.log('Host not installed.');
- } else {
- console.log('Host version: ' + version);
- }
- };
-
- hostDaemonFacade.getDaemonVersion().then(printVersion, function() {
- console.log('Host version not available.');
- });
-
- return hostDaemonFacade;
-};
-
-/**
* Set of features for which hasFeature() can be used to test.
*
* @enum {string}
@@ -410,6 +402,14 @@ remoting.HostController.prototype.getLocalHostId = function(onDone) {
};
/**
+ * @return {Promise<string>} Promise that resolves with the host version, if
+ * installed, or rejects otherwise.
+ */
+remoting.HostController.prototype.getLocalHostVersion = function() {
+ return this.hostDaemonFacade_.getDaemonVersion();
+};
+
+/**
* Fetch the list of paired clients for this host.
*
* @param {function(Array<remoting.PairedClient>):void} onDone