Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(354)

Unified Diff: remoting/webapp/crd/js/host_controller.js

Issue 1176693002: Add more host-side connection state logging for IT2Me. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Log connection-canceled if the user cancels installation. Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: remoting/webapp/crd/js/host_controller.js
diff --git a/remoting/webapp/crd/js/host_controller.js b/remoting/webapp/crd/js/host_controller.js
index 9ef8278a6118fb51de01bbaae770e15a5067cac2..e01a7bf2f7b4a8f367f36539bd2ad1fa09ba1a54 100644
--- a/remoting/webapp/crd/js/host_controller.js
+++ b/remoting/webapp/crd/js/host_controller.js
@@ -9,7 +9,21 @@ 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, function() {
kelvinp 2015/06/10 18:00:45 Nit: Use .catch for error handling for readability
Jamie 2015/06/10 18:14:44 Done.
+ console.log('Host version not available.');
+ });
};
// The values in the enums below are duplicated in daemon_controller.h except
@@ -56,30 +70,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}
@@ -419,6 +409,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

Powered by Google App Engine
This is Rietveld 408576698