OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 components via Native Messaging. | 7 * Class to communicate with the Host components via Native Messaging. |
8 */ | 8 */ |
9 | 9 |
10 'use strict'; | 10 'use strict'; |
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
245 case 'updateDaemonConfigResponse': | 245 case 'updateDaemonConfigResponse': |
246 var result = asAsyncResult_(message['result']); | 246 var result = asAsyncResult_(message['result']); |
247 if (result != null) { | 247 if (result != null) { |
248 callback(result); | 248 callback(result); |
249 } | 249 } |
250 break; | 250 break; |
251 | 251 |
252 case 'getDaemonConfigResponse': | 252 case 'getDaemonConfigResponse': |
253 /** @type {*} */ | 253 /** @type {*} */ |
254 var config = message['config']; | 254 var config = message['config']; |
255 if (checkType_('config', config, 'string')) { | 255 if (checkType_('config', config, 'object')) { |
256 callback(config); | 256 callback(config); |
257 } | 257 } |
258 break; | 258 break; |
259 | 259 |
260 case 'getUsageStatsConsentResponse': | 260 case 'getUsageStatsConsentResponse': |
261 /** @type {*} */ | 261 /** @type {*} */ |
262 var supported = message['supported']; | 262 var supported = message['supported']; |
263 /** @type {*} */ | 263 /** @type {*} */ |
264 var allowed = message['allowed']; | 264 var allowed = message['allowed']; |
265 /** @type {*} */ | 265 /** @type {*} */ |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
365 }; | 365 }; |
366 | 366 |
367 /** | 367 /** |
368 * Updates host config with the values specified in |config|. All | 368 * Updates host config with the values specified in |config|. All |
369 * fields that are not specified in |config| remain | 369 * fields that are not specified in |config| remain |
370 * unchanged. Following parameters cannot be changed using this | 370 * unchanged. Following parameters cannot be changed using this |
371 * function: host_id, xmpp_login. Error is returned if |config| | 371 * function: host_id, xmpp_login. Error is returned if |config| |
372 * includes these parameters. Changes take effect before the callback | 372 * includes these parameters. Changes take effect before the callback |
373 * is called. | 373 * is called. |
374 * | 374 * |
375 * @param {string} config The new config parameters, JSON encoded dictionary. | 375 * @param {Object} config The new config parameters. |
376 * @param {function(remoting.HostController.AsyncResult):void} callback | 376 * @param {function(remoting.HostController.AsyncResult):void} callback |
377 * Callback to be called when finished. | 377 * Callback to be called when finished. |
378 * @return {void} Nothing. | 378 * @return {void} Nothing. |
379 */ | 379 */ |
380 remoting.HostNativeMessaging.prototype.updateDaemonConfig = | 380 remoting.HostNativeMessaging.prototype.updateDaemonConfig = |
381 function(config, callback) { | 381 function(config, callback) { |
382 this.postMessage_({ | 382 this.postMessage_({ |
383 type: 'updateDaemonConfig', | 383 type: 'updateDaemonConfig', |
384 config: config | 384 config: config |
385 }, callback); | 385 }, callback); |
386 }; | 386 }; |
387 | 387 |
388 /** | 388 /** |
389 * Loads daemon config. The config is passed as a JSON formatted string to the | 389 * Loads daemon config. The config is passed as a JSON formatted string to the |
390 * callback. | 390 * callback. |
391 * | 391 * |
392 * @param {function(string):void} callback Callback. | 392 * @param {function(Object):void} callback Callback. |
393 * @return {void} Nothing. | 393 * @return {void} Nothing. |
394 */ | 394 */ |
395 remoting.HostNativeMessaging.prototype.getDaemonConfig = function(callback) { | 395 remoting.HostNativeMessaging.prototype.getDaemonConfig = function(callback) { |
396 this.postMessage_({type: 'getDaemonConfig'}, callback); | 396 this.postMessage_({type: 'getDaemonConfig'}, callback); |
397 }; | 397 }; |
398 | 398 |
399 /** | 399 /** |
400 * Retrieves daemon version. The version is passed to the callback as a dotted | 400 * Retrieves daemon version. The version is passed to the callback as a dotted |
401 * decimal string of the form major.minor.build.patch. | 401 * decimal string of the form major.minor.build.patch. |
402 * | 402 * |
(...skipping 15 matching lines...) Expand all Loading... |
418 * @return {void} Nothing. | 418 * @return {void} Nothing. |
419 */ | 419 */ |
420 remoting.HostNativeMessaging.prototype.getUsageStatsConsent = | 420 remoting.HostNativeMessaging.prototype.getUsageStatsConsent = |
421 function(callback) { | 421 function(callback) { |
422 this.postMessage_({type: 'getUsageStatsConsent'}, callback); | 422 this.postMessage_({type: 'getUsageStatsConsent'}, callback); |
423 }; | 423 }; |
424 | 424 |
425 /** | 425 /** |
426 * Starts the daemon process with the specified configuration. | 426 * Starts the daemon process with the specified configuration. |
427 * | 427 * |
428 * @param {string} config Host configuration. | 428 * @param {Object} config Host configuration. |
429 * @param {boolean} consent Consent to report crash dumps. | 429 * @param {boolean} consent Consent to report crash dumps. |
430 * @param {function(remoting.HostController.AsyncResult):void} callback | 430 * @param {function(remoting.HostController.AsyncResult):void} callback |
431 * Callback. | 431 * Callback. |
432 * @return {void} Nothing. | 432 * @return {void} Nothing. |
433 */ | 433 */ |
434 remoting.HostNativeMessaging.prototype.startDaemon = function( | 434 remoting.HostNativeMessaging.prototype.startDaemon = function( |
435 config, consent, callback) { | 435 config, consent, callback) { |
436 this.postMessage_({ | 436 this.postMessage_({ |
437 type: 'startDaemon', | 437 type: 'startDaemon', |
438 config: config, | 438 config: config, |
(...skipping 14 matching lines...) Expand all Loading... |
453 | 453 |
454 /** | 454 /** |
455 * Gets the installed/running state of the Host process. | 455 * Gets the installed/running state of the Host process. |
456 * | 456 * |
457 * @param {function(remoting.HostController.State):void} callback Callback. | 457 * @param {function(remoting.HostController.State):void} callback Callback. |
458 * @return {void} Nothing. | 458 * @return {void} Nothing. |
459 */ | 459 */ |
460 remoting.HostNativeMessaging.prototype.getDaemonState = function(callback) { | 460 remoting.HostNativeMessaging.prototype.getDaemonState = function(callback) { |
461 this.postMessage_({type: 'getDaemonState'}, callback); | 461 this.postMessage_({type: 'getDaemonState'}, callback); |
462 } | 462 } |
OLD | NEW |