| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 /** | 5 /** |
| 6 * @fileoverview | 6 * @fileoverview |
| 7 * Class to communicate with the host daemon via Native Messaging. | 7 * Class to communicate with the host daemon via Native Messaging. |
| 8 */ | 8 */ |
| 9 | 9 |
| 10 'use strict'; | 10 'use strict'; |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 /** @private {Array<function(boolean):void>} */ | 34 /** @private {Array<function(boolean):void>} */ |
| 35 this.afterInitializationTasks_ = []; | 35 this.afterInitializationTasks_ = []; |
| 36 | 36 |
| 37 /** | 37 /** |
| 38 * A promise that fulfills when the daemon finishes initializing. | 38 * A promise that fulfills when the daemon finishes initializing. |
| 39 * It will be set to null when the promise fulfills. | 39 * It will be set to null when the promise fulfills. |
| 40 * @private {Promise} | 40 * @private {Promise} |
| 41 */ | 41 */ |
| 42 this.initializingPromise_ = null; | 42 this.initializingPromise_ = null; |
| 43 | 43 |
| 44 /** @private {remoting.Error} */ | 44 /** @private {!remoting.Error} */ |
| 45 this.error_ = remoting.Error.NONE; | 45 this.error_ = remoting.Error.NONE; |
| 46 | 46 |
| 47 /** @private */ | 47 /** @private */ |
| 48 this.onIncomingMessageCallback_ = this.onIncomingMessage_.bind(this); | 48 this.onIncomingMessageCallback_ = this.onIncomingMessage_.bind(this); |
| 49 | 49 |
| 50 /** @private */ | 50 /** @private */ |
| 51 this.onDisconnectCallback_ = this.onDisconnect_.bind(this); | 51 this.onDisconnectCallback_ = this.onDisconnect_.bind(this); |
| 52 | 52 |
| 53 this.initialize_(); | 53 this.initialize_(); |
| 54 }; | 54 }; |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 | 104 |
| 105 return new Promise(connect.bind(this)); | 105 return new Promise(connect.bind(this)); |
| 106 }; | 106 }; |
| 107 | 107 |
| 108 /** | 108 /** |
| 109 * Type used for entries of |pendingReplies_| list. | 109 * Type used for entries of |pendingReplies_| list. |
| 110 * | 110 * |
| 111 * @param {string} type Type of the originating request. | 111 * @param {string} type Type of the originating request. |
| 112 * @param {function(...):void} onDone Response callback. Parameters depend on | 112 * @param {function(...):void} onDone Response callback. Parameters depend on |
| 113 * the request type. | 113 * the request type. |
| 114 * @param {function(remoting.Error):void} onError Callback to call on error. | 114 * @param {function(!remoting.Error):void} onError Callback to call on error. |
| 115 * @constructor | 115 * @constructor |
| 116 */ | 116 */ |
| 117 remoting.HostDaemonFacade.PendingReply = function(type, onDone, onError) { | 117 remoting.HostDaemonFacade.PendingReply = function(type, onDone, onError) { |
| 118 this.type = type; | 118 this.type = type; |
| 119 this.onDone = onDone; | 119 this.onDone = onDone; |
| 120 this.onError = onError; | 120 this.onError = onError; |
| 121 }; | 121 }; |
| 122 | 122 |
| 123 /** | 123 /** |
| 124 * @param {remoting.HostController.Feature} feature The feature to test for. | 124 * @param {remoting.HostController.Feature} feature The feature to test for. |
| 125 * @param {function(boolean):void} onDone Callback to return result. | 125 * @param {function(boolean):void} onDone Callback to return result. |
| 126 * @return {boolean} True if the implementation supports the named feature. | 126 * @return {boolean} True if the implementation supports the named feature. |
| 127 */ | 127 */ |
| 128 remoting.HostDaemonFacade.prototype.hasFeature = function(feature, onDone) { | 128 remoting.HostDaemonFacade.prototype.hasFeature = function(feature, onDone) { |
| 129 /** @type {remoting.HostDaemonFacade} */ | 129 /** @type {remoting.HostDaemonFacade} */ |
| 130 var that = this; | 130 var that = this; |
| 131 this.initialize_().then(function() { | 131 this.initialize_().then(function() { |
| 132 onDone(that.supportedFeatures_.indexOf(feature) >= 0); | 132 onDone(that.supportedFeatures_.indexOf(feature) >= 0); |
| 133 }, function (){ | 133 }, function (){ |
| 134 onDone(false); | 134 onDone(false); |
| 135 }); | 135 }); |
| 136 }; | 136 }; |
| 137 | 137 |
| 138 /** | 138 /** |
| 139 * Initializes that the Daemon if necessary and posts the supplied message. | 139 * Initializes that the Daemon if necessary and posts the supplied message. |
| 140 * | 140 * |
| 141 * @param {{type: string}} message The message to post. | 141 * @param {{type: string}} message The message to post. |
| 142 * @param {function(...):void} onDone The callback, if any, to be triggered | 142 * @param {function(...):void} onDone The callback, if any, to be triggered |
| 143 * on response. | 143 * on response. |
| 144 * @param {function(remoting.Error):void} onError Callback to call on error. | 144 * @param {function(!remoting.Error):void} onError Callback to call on error. |
| 145 * @private | 145 * @private |
| 146 */ | 146 */ |
| 147 remoting.HostDaemonFacade.prototype.postMessage_ = | 147 remoting.HostDaemonFacade.prototype.postMessage_ = |
| 148 function(message, onDone, onError) { | 148 function(message, onDone, onError) { |
| 149 /** @type {remoting.HostDaemonFacade} */ | 149 /** @type {remoting.HostDaemonFacade} */ |
| 150 var that = this; | 150 var that = this; |
| 151 this.initialize_().then(function() { | 151 this.initialize_().then(function() { |
| 152 that.postMessageInternal_(message, onDone, onError); | 152 that.postMessageInternal_(message, onDone, onError); |
| 153 }, function() { | 153 }, function() { |
| 154 onError(that.error_); | 154 onError(that.error_); |
| 155 }); | 155 }); |
| 156 }; | 156 }; |
| 157 | 157 |
| 158 /** | 158 /** |
| 159 * Attaches a new ID to the supplied message, and posts it to the Native | 159 * Attaches a new ID to the supplied message, and posts it to the Native |
| 160 * Messaging port, adding |onDone| to the list of pending replies. | 160 * Messaging port, adding |onDone| to the list of pending replies. |
| 161 * |message| should have its 'type' field set, and any other fields set | 161 * |message| should have its 'type' field set, and any other fields set |
| 162 * depending on the message type. | 162 * depending on the message type. |
| 163 * | 163 * |
| 164 * @param {{type: string}} message The message to post. | 164 * @param {{type: string}} message The message to post. |
| 165 * @param {function(...):void} onDone The callback, if any, to be triggered | 165 * @param {function(...):void} onDone The callback, if any, to be triggered |
| 166 * on response. | 166 * on response. |
| 167 * @param {function(remoting.Error):void} onError Callback to call on error. | 167 * @param {function(!remoting.Error):void} onError Callback to call on error. |
| 168 * @return {void} Nothing. | 168 * @return {void} Nothing. |
| 169 * @private | 169 * @private |
| 170 */ | 170 */ |
| 171 remoting.HostDaemonFacade.prototype.postMessageInternal_ = | 171 remoting.HostDaemonFacade.prototype.postMessageInternal_ = |
| 172 function(message, onDone, onError) { | 172 function(message, onDone, onError) { |
| 173 var id = this.nextId_++; | 173 var id = this.nextId_++; |
| 174 message['id'] = id; | 174 message['id'] = id; |
| 175 this.pendingReplies_[id] = new remoting.HostDaemonFacade.PendingReply( | 175 this.pendingReplies_[id] = new remoting.HostDaemonFacade.PendingReply( |
| 176 message.type + 'Response', onDone, onError); | 176 message.type + 'Response', onDone, onError); |
| 177 this.port_.postMessage(message); | 177 this.port_.postMessage(message); |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 333 for (var id in pendingReplies) { | 333 for (var id in pendingReplies) { |
| 334 var num_id = parseInt(id, 10); | 334 var num_id = parseInt(id, 10); |
| 335 pendingReplies[num_id].onError(this.error_); | 335 pendingReplies[num_id].onError(this.error_); |
| 336 } | 336 } |
| 337 } | 337 } |
| 338 | 338 |
| 339 /** | 339 /** |
| 340 * Gets local hostname. | 340 * Gets local hostname. |
| 341 * | 341 * |
| 342 * @param {function(string):void} onDone Callback to return result. | 342 * @param {function(string):void} onDone Callback to return result. |
| 343 * @param {function(remoting.Error):void} onError Callback to call on error. | 343 * @param {function(!remoting.Error):void} onError Callback to call on error. |
| 344 * @return {void} Nothing. | 344 * @return {void} Nothing. |
| 345 */ | 345 */ |
| 346 remoting.HostDaemonFacade.prototype.getHostName = | 346 remoting.HostDaemonFacade.prototype.getHostName = |
| 347 function(onDone, onError) { | 347 function(onDone, onError) { |
| 348 this.postMessage_({type: 'getHostName'}, onDone, onError); | 348 this.postMessage_({type: 'getHostName'}, onDone, onError); |
| 349 }; | 349 }; |
| 350 | 350 |
| 351 /** | 351 /** |
| 352 * Calculates PIN hash value to be stored in the config, passing the resulting | 352 * Calculates PIN hash value to be stored in the config, passing the resulting |
| 353 * hash value base64-encoded to the callback. | 353 * hash value base64-encoded to the callback. |
| 354 * | 354 * |
| 355 * @param {string} hostId The host ID. | 355 * @param {string} hostId The host ID. |
| 356 * @param {string} pin The PIN. | 356 * @param {string} pin The PIN. |
| 357 * @param {function(string):void} onDone Callback to return result. | 357 * @param {function(string):void} onDone Callback to return result. |
| 358 * @param {function(remoting.Error):void} onError Callback to call on error. | 358 * @param {function(!remoting.Error):void} onError Callback to call on error. |
| 359 * @return {void} Nothing. | 359 * @return {void} Nothing. |
| 360 */ | 360 */ |
| 361 remoting.HostDaemonFacade.prototype.getPinHash = | 361 remoting.HostDaemonFacade.prototype.getPinHash = |
| 362 function(hostId, pin, onDone, onError) { | 362 function(hostId, pin, onDone, onError) { |
| 363 this.postMessage_({ | 363 this.postMessage_({ |
| 364 type: 'getPinHash', | 364 type: 'getPinHash', |
| 365 hostId: hostId, | 365 hostId: hostId, |
| 366 pin: pin | 366 pin: pin |
| 367 }, onDone, onError); | 367 }, onDone, onError); |
| 368 }; | 368 }; |
| 369 | 369 |
| 370 /** | 370 /** |
| 371 * Generates new key pair to use for the host. The specified callback is called | 371 * Generates new key pair to use for the host. The specified callback is called |
| 372 * when the key is generated. The key is returned in format understood by the | 372 * when the key is generated. The key is returned in format understood by the |
| 373 * host (PublicKeyInfo structure encoded with ASN.1 DER, and then BASE64). | 373 * host (PublicKeyInfo structure encoded with ASN.1 DER, and then BASE64). |
| 374 * | 374 * |
| 375 * @param {function(string, string):void} onDone Callback to return result. | 375 * @param {function(string, string):void} onDone Callback to return result. |
| 376 * @param {function(remoting.Error):void} onError Callback to call on error. | 376 * @param {function(!remoting.Error):void} onError Callback to call on error. |
| 377 * @return {void} Nothing. | 377 * @return {void} Nothing. |
| 378 */ | 378 */ |
| 379 remoting.HostDaemonFacade.prototype.generateKeyPair = | 379 remoting.HostDaemonFacade.prototype.generateKeyPair = |
| 380 function(onDone, onError) { | 380 function(onDone, onError) { |
| 381 this.postMessage_({type: 'generateKeyPair'}, onDone, onError); | 381 this.postMessage_({type: 'generateKeyPair'}, onDone, onError); |
| 382 }; | 382 }; |
| 383 | 383 |
| 384 /** | 384 /** |
| 385 * Updates host config with the values specified in |config|. All | 385 * Updates host config with the values specified in |config|. All |
| 386 * fields that are not specified in |config| remain | 386 * fields that are not specified in |config| remain |
| 387 * unchanged. Following parameters cannot be changed using this | 387 * unchanged. Following parameters cannot be changed using this |
| 388 * function: host_id, xmpp_login. Error is returned if |config| | 388 * function: host_id, xmpp_login. Error is returned if |config| |
| 389 * includes these parameters. Changes take effect before the callback | 389 * includes these parameters. Changes take effect before the callback |
| 390 * is called. | 390 * is called. |
| 391 * | 391 * |
| 392 * @param {Object} config The new config parameters. | 392 * @param {Object} config The new config parameters. |
| 393 * @param {function(remoting.HostController.AsyncResult):void} onDone | 393 * @param {function(remoting.HostController.AsyncResult):void} onDone |
| 394 * Callback to be called when finished. | 394 * Callback to be called when finished. |
| 395 * @param {function(remoting.Error):void} onError Callback to call on error. | 395 * @param {function(!remoting.Error):void} onError Callback to call on error. |
| 396 * @return {void} Nothing. | 396 * @return {void} Nothing. |
| 397 */ | 397 */ |
| 398 remoting.HostDaemonFacade.prototype.updateDaemonConfig = | 398 remoting.HostDaemonFacade.prototype.updateDaemonConfig = |
| 399 function(config, onDone, onError) { | 399 function(config, onDone, onError) { |
| 400 this.postMessage_({ | 400 this.postMessage_({ |
| 401 type: 'updateDaemonConfig', | 401 type: 'updateDaemonConfig', |
| 402 config: config | 402 config: config |
| 403 }, onDone, onError); | 403 }, onDone, onError); |
| 404 }; | 404 }; |
| 405 | 405 |
| 406 /** | 406 /** |
| 407 * Loads daemon config. The config is passed as a JSON formatted string to the | 407 * Loads daemon config. The config is passed as a JSON formatted string to the |
| 408 * callback. | 408 * callback. |
| 409 * | 409 * |
| 410 * @param {function(Object):void} onDone Callback to return result. | 410 * @param {function(Object):void} onDone Callback to return result. |
| 411 * @param {function(remoting.Error):void} onError Callback to call on error. | 411 * @param {function(!remoting.Error):void} onError Callback to call on error. |
| 412 * @return {void} Nothing. | 412 * @return {void} Nothing. |
| 413 */ | 413 */ |
| 414 remoting.HostDaemonFacade.prototype.getDaemonConfig = | 414 remoting.HostDaemonFacade.prototype.getDaemonConfig = |
| 415 function(onDone, onError) { | 415 function(onDone, onError) { |
| 416 this.postMessage_({type: 'getDaemonConfig'}, onDone, onError); | 416 this.postMessage_({type: 'getDaemonConfig'}, onDone, onError); |
| 417 }; | 417 }; |
| 418 | 418 |
| 419 /** | 419 /** |
| 420 * Retrieves daemon version. The version is passed to onDone as a dotted decimal | 420 * Retrieves daemon version. The version is passed to onDone as a dotted decimal |
| 421 * string of the form major.minor.build.patch. | 421 * string of the form major.minor.build.patch. |
| 422 * | 422 * |
| 423 * @param {function(string):void} onDone Callback to be called to return result. | 423 * @param {function(string):void} onDone Callback to be called to return result. |
| 424 * @param {function(remoting.Error):void} onError Callback to call on error. | 424 * @param {function(!remoting.Error):void} onError Callback to call on error. |
| 425 * @return {void} | 425 * @return {void} |
| 426 */ | 426 */ |
| 427 remoting.HostDaemonFacade.prototype.getDaemonVersion = | 427 remoting.HostDaemonFacade.prototype.getDaemonVersion = |
| 428 function(onDone, onError) { | 428 function(onDone, onError) { |
| 429 /** @type {remoting.HostDaemonFacade} */ | 429 /** @type {remoting.HostDaemonFacade} */ |
| 430 var that = this; | 430 var that = this; |
| 431 this.initialize_().then(function() { | 431 this.initialize_().then(function() { |
| 432 onDone(that.version_); | 432 onDone(that.version_); |
| 433 }, function() { | 433 }, function() { |
| 434 onError(that.error_); | 434 onError(that.error_); |
| 435 }); | 435 }); |
| 436 }; | 436 }; |
| 437 | 437 |
| 438 /** | 438 /** |
| 439 * Get the user's consent to crash reporting. The consent flags are passed to | 439 * Get the user's consent to crash reporting. The consent flags are passed to |
| 440 * the callback as booleans: supported, allowed, set-by-policy. | 440 * the callback as booleans: supported, allowed, set-by-policy. |
| 441 * | 441 * |
| 442 * @param {function(boolean, boolean, boolean):void} onDone Callback to return | 442 * @param {function(boolean, boolean, boolean):void} onDone Callback to return |
| 443 * result. | 443 * result. |
| 444 * @param {function(remoting.Error):void} onError Callback to call on error. | 444 * @param {function(!remoting.Error):void} onError Callback to call on error. |
| 445 * @return {void} Nothing. | 445 * @return {void} Nothing. |
| 446 */ | 446 */ |
| 447 remoting.HostDaemonFacade.prototype.getUsageStatsConsent = | 447 remoting.HostDaemonFacade.prototype.getUsageStatsConsent = |
| 448 function(onDone, onError) { | 448 function(onDone, onError) { |
| 449 this.postMessage_({type: 'getUsageStatsConsent'}, onDone, onError); | 449 this.postMessage_({type: 'getUsageStatsConsent'}, onDone, onError); |
| 450 }; | 450 }; |
| 451 | 451 |
| 452 /** | 452 /** |
| 453 * Starts the daemon process with the specified configuration. | 453 * Starts the daemon process with the specified configuration. |
| 454 * | 454 * |
| 455 * @param {Object} config Host configuration. | 455 * @param {Object} config Host configuration. |
| 456 * @param {boolean} consent Consent to report crash dumps. | 456 * @param {boolean} consent Consent to report crash dumps. |
| 457 * @param {function(remoting.HostController.AsyncResult):void} onDone | 457 * @param {function(remoting.HostController.AsyncResult):void} onDone |
| 458 * Callback to return result. | 458 * Callback to return result. |
| 459 * @param {function(remoting.Error):void} onError Callback to call on error. | 459 * @param {function(!remoting.Error):void} onError Callback to call on error. |
| 460 * @return {void} Nothing. | 460 * @return {void} Nothing. |
| 461 */ | 461 */ |
| 462 remoting.HostDaemonFacade.prototype.startDaemon = | 462 remoting.HostDaemonFacade.prototype.startDaemon = |
| 463 function(config, consent, onDone, onError) { | 463 function(config, consent, onDone, onError) { |
| 464 this.postMessage_({ | 464 this.postMessage_({ |
| 465 type: 'startDaemon', | 465 type: 'startDaemon', |
| 466 config: config, | 466 config: config, |
| 467 consent: consent | 467 consent: consent |
| 468 }, onDone, onError); | 468 }, onDone, onError); |
| 469 }; | 469 }; |
| 470 | 470 |
| 471 /** | 471 /** |
| 472 * Stops the daemon process. | 472 * Stops the daemon process. |
| 473 * | 473 * |
| 474 * @param {function(remoting.HostController.AsyncResult):void} onDone | 474 * @param {function(remoting.HostController.AsyncResult):void} onDone |
| 475 * Callback to return result. | 475 * Callback to return result. |
| 476 * @param {function(remoting.Error):void} onError Callback to call on error. | 476 * @param {function(!remoting.Error):void} onError Callback to call on error. |
| 477 * @return {void} Nothing. | 477 * @return {void} Nothing. |
| 478 */ | 478 */ |
| 479 remoting.HostDaemonFacade.prototype.stopDaemon = | 479 remoting.HostDaemonFacade.prototype.stopDaemon = |
| 480 function(onDone, onError) { | 480 function(onDone, onError) { |
| 481 this.postMessage_({type: 'stopDaemon'}, onDone, onError); | 481 this.postMessage_({type: 'stopDaemon'}, onDone, onError); |
| 482 }; | 482 }; |
| 483 | 483 |
| 484 /** | 484 /** |
| 485 * Gets the installed/running state of the Host process. | 485 * Gets the installed/running state of the Host process. |
| 486 * | 486 * |
| 487 * @param {function(remoting.HostController.State):void} onDone Callback to | 487 * @param {function(remoting.HostController.State):void} onDone Callback to |
| 488 * return result. | 488 * return result. |
| 489 * @param {function(remoting.Error):void} onError Callback to call on error. | 489 * @param {function(!remoting.Error):void} onError Callback to call on error. |
| 490 * @return {void} Nothing. | 490 * @return {void} Nothing. |
| 491 */ | 491 */ |
| 492 remoting.HostDaemonFacade.prototype.getDaemonState = | 492 remoting.HostDaemonFacade.prototype.getDaemonState = |
| 493 function(onDone, onError) { | 493 function(onDone, onError) { |
| 494 this.postMessage_({type: 'getDaemonState'}, onDone, onError); | 494 this.postMessage_({type: 'getDaemonState'}, onDone, onError); |
| 495 } | 495 } |
| 496 | 496 |
| 497 /** | 497 /** |
| 498 * Retrieves the list of paired clients. | 498 * Retrieves the list of paired clients. |
| 499 * | 499 * |
| 500 * @param {function(Array<remoting.PairedClient>):void} onDone Callback to | 500 * @param {function(Array<remoting.PairedClient>):void} onDone Callback to |
| 501 * return result. | 501 * return result. |
| 502 * @param {function(remoting.Error):void} onError Callback to call on error. | 502 * @param {function(!remoting.Error):void} onError Callback to call on error. |
| 503 */ | 503 */ |
| 504 remoting.HostDaemonFacade.prototype.getPairedClients = | 504 remoting.HostDaemonFacade.prototype.getPairedClients = |
| 505 function(onDone, onError) { | 505 function(onDone, onError) { |
| 506 this.postMessage_({type: 'getPairedClients'}, onDone, onError); | 506 this.postMessage_({type: 'getPairedClients'}, onDone, onError); |
| 507 } | 507 } |
| 508 | 508 |
| 509 /** | 509 /** |
| 510 * Clears all paired clients from the registry. | 510 * Clears all paired clients from the registry. |
| 511 * | 511 * |
| 512 * @param {function(boolean):void} onDone Callback to be called when finished. | 512 * @param {function(boolean):void} onDone Callback to be called when finished. |
| 513 * @param {function(remoting.Error):void} onError Callback to call on error. | 513 * @param {function(!remoting.Error):void} onError Callback to call on error. |
| 514 */ | 514 */ |
| 515 remoting.HostDaemonFacade.prototype.clearPairedClients = | 515 remoting.HostDaemonFacade.prototype.clearPairedClients = |
| 516 function(onDone, onError) { | 516 function(onDone, onError) { |
| 517 this.postMessage_({type: 'clearPairedClients'}, onDone, onError); | 517 this.postMessage_({type: 'clearPairedClients'}, onDone, onError); |
| 518 } | 518 } |
| 519 | 519 |
| 520 /** | 520 /** |
| 521 * Deletes a paired client referenced by client id. | 521 * Deletes a paired client referenced by client id. |
| 522 * | 522 * |
| 523 * @param {string} client Client to delete. | 523 * @param {string} client Client to delete. |
| 524 * @param {function(boolean):void} onDone Callback to be called when finished. | 524 * @param {function(boolean):void} onDone Callback to be called when finished. |
| 525 * @param {function(remoting.Error):void} onError Callback to call on error. | 525 * @param {function(!remoting.Error):void} onError Callback to call on error. |
| 526 */ | 526 */ |
| 527 remoting.HostDaemonFacade.prototype.deletePairedClient = | 527 remoting.HostDaemonFacade.prototype.deletePairedClient = |
| 528 function(client, onDone, onError) { | 528 function(client, onDone, onError) { |
| 529 this.postMessage_({ | 529 this.postMessage_({ |
| 530 type: 'deletePairedClient', | 530 type: 'deletePairedClient', |
| 531 clientId: client | 531 clientId: client |
| 532 }, onDone, onError); | 532 }, onDone, onError); |
| 533 } | 533 } |
| 534 | 534 |
| 535 /** | 535 /** |
| 536 * Gets the API keys to obtain/use service account credentials. | 536 * Gets the API keys to obtain/use service account credentials. |
| 537 * | 537 * |
| 538 * @param {function(string):void} onDone Callback to return result. | 538 * @param {function(string):void} onDone Callback to return result. |
| 539 * @param {function(remoting.Error):void} onError Callback to call on error. | 539 * @param {function(!remoting.Error):void} onError Callback to call on error. |
| 540 * @return {void} Nothing. | 540 * @return {void} Nothing. |
| 541 */ | 541 */ |
| 542 remoting.HostDaemonFacade.prototype.getHostClientId = | 542 remoting.HostDaemonFacade.prototype.getHostClientId = |
| 543 function(onDone, onError) { | 543 function(onDone, onError) { |
| 544 this.postMessage_({type: 'getHostClientId'}, onDone, onError); | 544 this.postMessage_({type: 'getHostClientId'}, onDone, onError); |
| 545 }; | 545 }; |
| 546 | 546 |
| 547 /** | 547 /** |
| 548 * | 548 * |
| 549 * @param {string} authorizationCode OAuth authorization code. | 549 * @param {string} authorizationCode OAuth authorization code. |
| 550 * @param {function(string, string):void} onDone Callback to return result. | 550 * @param {function(string, string):void} onDone Callback to return result. |
| 551 * @param {function(remoting.Error):void} onError Callback to call on error. | 551 * @param {function(!remoting.Error):void} onError Callback to call on error. |
| 552 * @return {void} Nothing. | 552 * @return {void} Nothing. |
| 553 */ | 553 */ |
| 554 remoting.HostDaemonFacade.prototype.getCredentialsFromAuthCode = | 554 remoting.HostDaemonFacade.prototype.getCredentialsFromAuthCode = |
| 555 function(authorizationCode, onDone, onError) { | 555 function(authorizationCode, onDone, onError) { |
| 556 this.postMessage_({ | 556 this.postMessage_({ |
| 557 type: 'getCredentialsFromAuthCode', | 557 type: 'getCredentialsFromAuthCode', |
| 558 authorizationCode: authorizationCode | 558 authorizationCode: authorizationCode |
| 559 }, onDone, onError); | 559 }, onDone, onError); |
| 560 }; | 560 }; |
| OLD | NEW |