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

Side by Side Diff: remoting/webapp/host_native_messaging.js

Issue 19597006: Style cleanup: Rename callback -> onDone in chromoting webapp. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix function declaration style/indentation Created 7 years, 5 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « remoting/webapp/host_dispatcher.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 21 matching lines...) Expand all
32 this.port_ = null; 32 this.port_ = null;
33 33
34 /** @type {string} @private */ 34 /** @type {string} @private */
35 this.version_ = '' 35 this.version_ = ''
36 }; 36 };
37 37
38 /** 38 /**
39 * Type used for entries of |pendingReplies_| list. 39 * Type used for entries of |pendingReplies_| list.
40 * 40 *
41 * @param {string} type Type of the originating request. 41 * @param {string} type Type of the originating request.
42 * @param {?function(...):void} callback The callback, if any, to be triggered 42 * @param {?function(...):void} onDone The callback, if any, to be triggered
43 * on response. The actual parameters depend on the original request type. 43 * on response. The actual parameters depend on the original request type.
44 * @param {function(remoting.Error):void} onError The callback to be triggered 44 * @param {function(remoting.Error):void} onError The callback to be triggered
45 * on error. 45 * on error.
46 * @constructor 46 * @constructor
47 */ 47 */
48 remoting.HostNativeMessaging.PendingReply = function(type, callback, onError) { 48 remoting.HostNativeMessaging.PendingReply = function(type, onDone, onError) {
49 this.type = type; 49 this.type = type;
50 this.callback = callback; 50 this.onDone = onDone;
51 this.onError = onError; 51 this.onError = onError;
52 }; 52 };
53 53
54 /** 54 /**
55 * Sets up connection to the Native Messaging host process and exchanges 55 * Sets up connection to the Native Messaging host process and exchanges
56 * 'hello' messages. If Native Messaging is not available or the host 56 * 'hello' messages. If Native Messaging is not available or the host
57 * process is not installed, this returns false to the callback. 57 * process is not installed, this returns false to the callback.
58 * 58 *
59 * @param {function(boolean): void} onDone Called with the result of 59 * @param {function(boolean): void} onDone Called with the result of
60 * initialization. 60 * initialization.
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 } 140 }
141 if (!remoting.HostController.State.hasOwnProperty(result)) { 141 if (!remoting.HostController.State.hasOwnProperty(result)) {
142 console.error('NativeMessaging: unexpected result code: ', result); 142 console.error('NativeMessaging: unexpected result code: ', result);
143 return null; 143 return null;
144 } 144 }
145 return remoting.HostController.State[result]; 145 return remoting.HostController.State[result];
146 } 146 }
147 147
148 /** 148 /**
149 * Attaches a new ID to the supplied message, and posts it to the Native 149 * Attaches a new ID to the supplied message, and posts it to the Native
150 * Messaging port, adding |callback| to the list of pending replies. 150 * Messaging port, adding |onDone| to the list of pending replies.
151 * |message| should have its 'type' field set, and any other fields set 151 * |message| should have its 'type' field set, and any other fields set
152 * depending on the message type. 152 * depending on the message type.
153 * 153 *
154 * @param {{type: string}} message The message to post. 154 * @param {{type: string}} message The message to post.
155 * @param {?function(...):void} callback The callback, if any, to be triggered 155 * @param {?function(...):void} onDone The callback, if any, to be triggered
156 * on response. 156 * on response.
157 * @param {function(remoting.Error):void} onError The callback to be triggered 157 * @param {function(remoting.Error):void} onError The callback to be triggered
158 * on error. 158 * on error.
159 * @return {void} Nothing. 159 * @return {void} Nothing.
160 * @private 160 * @private
161 */ 161 */
162 remoting.HostNativeMessaging.prototype.postMessage_ = function(message, 162 remoting.HostNativeMessaging.prototype.postMessage_ =
163 callback, 163 function(message, onDone, onError) {
164 onError) {
165 var id = this.nextId_++; 164 var id = this.nextId_++;
166 message['id'] = id; 165 message['id'] = id;
167 this.pendingReplies_[id] = new remoting.HostNativeMessaging.PendingReply( 166 this.pendingReplies_[id] = new remoting.HostNativeMessaging.PendingReply(
168 message.type + 'Response', callback, onError); 167 message.type + 'Response', onDone, onError);
169 this.port_.postMessage(message); 168 this.port_.postMessage(message);
170 }; 169 };
171 170
172 /** 171 /**
173 * Handler for incoming Native Messages. 172 * Handler for incoming Native Messages.
174 * 173 *
175 * @param {Object} message The received message. 174 * @param {Object} message The received message.
176 * @return {void} Nothing. 175 * @return {void} Nothing.
177 * @private 176 * @private
178 */ 177 */
179 remoting.HostNativeMessaging.prototype.onIncomingMessage_ = function(message) { 178 remoting.HostNativeMessaging.prototype.onIncomingMessage_ = function(message) {
180 /** @type {number} */ 179 /** @type {number} */
181 var id = message['id']; 180 var id = message['id'];
182 if (typeof(id) != 'number') { 181 if (typeof(id) != 'number') {
183 console.error('NativeMessaging: missing or non-numeric id'); 182 console.error('NativeMessaging: missing or non-numeric id');
184 return; 183 return;
185 } 184 }
186 var reply = this.pendingReplies_[id]; 185 var reply = this.pendingReplies_[id];
187 if (!reply) { 186 if (!reply) {
188 console.error('NativeMessaging: unexpected id: ', id); 187 console.error('NativeMessaging: unexpected id: ', id);
189 return; 188 return;
190 } 189 }
191 delete this.pendingReplies_[id]; 190 delete this.pendingReplies_[id];
192 191
193 var callback = reply.callback; 192 var onDone = reply.onDone;
194 var onError = reply.onError; 193 var onError = reply.onError;
195 194
196 /** @type {string} */ 195 /** @type {string} */
197 var type = message['type']; 196 var type = message['type'];
198 if (!checkType_('type', type, 'string')) { 197 if (!checkType_('type', type, 'string')) {
199 onError(remoting.Error.UNEXPECTED); 198 onError(remoting.Error.UNEXPECTED);
200 return; 199 return;
201 } 200 }
202 if (type != reply.type) { 201 if (type != reply.type) {
203 console.error('NativeMessaging: expected reply type: ', reply.type, 202 console.error('NativeMessaging: expected reply type: ', reply.type,
204 ', got: ', type); 203 ', got: ', type);
205 onError(remoting.Error.UNEXPECTED); 204 onError(remoting.Error.UNEXPECTED);
206 return; 205 return;
207 } 206 }
208 207
209 switch (type) { 208 switch (type) {
210 case 'helloResponse': 209 case 'helloResponse':
211 /** @type {string} */ 210 /** @type {string} */
212 var version = message['version']; 211 var version = message['version'];
213 if (checkType_('version', version, 'string')) { 212 if (checkType_('version', version, 'string')) {
214 this.version_ = version; 213 this.version_ = version;
215 callback(); 214 onDone();
216 } else { 215 } else {
217 onError(remoting.Error.UNEXPECTED); 216 onError(remoting.Error.UNEXPECTED);
218 } 217 }
219 break; 218 break;
220 219
221 case 'getHostNameResponse': 220 case 'getHostNameResponse':
222 /** @type {*} */ 221 /** @type {*} */
223 var hostname = message['hostname']; 222 var hostname = message['hostname'];
224 if (checkType_('hostname', hostname, 'string')) { 223 if (checkType_('hostname', hostname, 'string')) {
225 callback(hostname); 224 onDone(hostname);
226 } else { 225 } else {
227 onError(remoting.Error.UNEXPECTED); 226 onError(remoting.Error.UNEXPECTED);
228 } 227 }
229 break; 228 break;
230 229
231 case 'getPinHashResponse': 230 case 'getPinHashResponse':
232 /** @type {*} */ 231 /** @type {*} */
233 var hash = message['hash']; 232 var hash = message['hash'];
234 if (checkType_('hash', hash, 'string')) { 233 if (checkType_('hash', hash, 'string')) {
235 callback(hash); 234 onDone(hash);
236 } else { 235 } else {
237 onError(remoting.Error.UNEXPECTED); 236 onError(remoting.Error.UNEXPECTED);
238 } 237 }
239 break; 238 break;
240 239
241 case 'generateKeyPairResponse': 240 case 'generateKeyPairResponse':
242 /** @type {*} */ 241 /** @type {*} */
243 var privateKey = message['privateKey']; 242 var privateKey = message['privateKey'];
244 /** @type {*} */ 243 /** @type {*} */
245 var publicKey = message['publicKey']; 244 var publicKey = message['publicKey'];
246 if (checkType_('privateKey', privateKey, 'string') && 245 if (checkType_('privateKey', privateKey, 'string') &&
247 checkType_('publicKey', publicKey, 'string')) { 246 checkType_('publicKey', publicKey, 'string')) {
248 callback(privateKey, publicKey); 247 onDone(privateKey, publicKey);
249 } else { 248 } else {
250 onError(remoting.Error.UNEXPECTED); 249 onError(remoting.Error.UNEXPECTED);
251 } 250 }
252 break; 251 break;
253 252
254 case 'updateDaemonConfigResponse': 253 case 'updateDaemonConfigResponse':
255 var result = asAsyncResult_(message['result']); 254 var result = asAsyncResult_(message['result']);
256 if (result != null) { 255 if (result != null) {
257 callback(result); 256 onDone(result);
258 } else { 257 } else {
259 onError(remoting.Error.UNEXPECTED); 258 onError(remoting.Error.UNEXPECTED);
260 } 259 }
261 break; 260 break;
262 261
263 case 'getDaemonConfigResponse': 262 case 'getDaemonConfigResponse':
264 /** @type {*} */ 263 /** @type {*} */
265 var config = message['config']; 264 var config = message['config'];
266 if (checkType_('config', config, 'object')) { 265 if (checkType_('config', config, 'object')) {
267 callback(config); 266 onDone(config);
268 } else { 267 } else {
269 onError(remoting.Error.UNEXPECTED); 268 onError(remoting.Error.UNEXPECTED);
270 } 269 }
271 break; 270 break;
272 271
273 case 'getUsageStatsConsentResponse': 272 case 'getUsageStatsConsentResponse':
274 /** @type {*} */ 273 /** @type {*} */
275 var supported = message['supported']; 274 var supported = message['supported'];
276 /** @type {*} */ 275 /** @type {*} */
277 var allowed = message['allowed']; 276 var allowed = message['allowed'];
278 /** @type {*} */ 277 /** @type {*} */
279 var setByPolicy = message['setByPolicy']; 278 var setByPolicy = message['setByPolicy'];
280 if (checkType_('supported', supported, 'boolean') && 279 if (checkType_('supported', supported, 'boolean') &&
281 checkType_('allowed', allowed, 'boolean') && 280 checkType_('allowed', allowed, 'boolean') &&
282 checkType_('setByPolicy', setByPolicy, 'boolean')) { 281 checkType_('setByPolicy', setByPolicy, 'boolean')) {
283 callback(supported, allowed, setByPolicy); 282 onDone(supported, allowed, setByPolicy);
284 } else { 283 } else {
285 onError(remoting.Error.UNEXPECTED); 284 onError(remoting.Error.UNEXPECTED);
286 } 285 }
287 break; 286 break;
288 287
289 case 'startDaemonResponse': 288 case 'startDaemonResponse':
290 case 'stopDaemonResponse': 289 case 'stopDaemonResponse':
291 var result = asAsyncResult_(message['result']); 290 var result = asAsyncResult_(message['result']);
292 if (result != null) { 291 if (result != null) {
293 callback(result); 292 onDone(result);
294 } else { 293 } else {
295 onError(remoting.Error.UNEXPECTED); 294 onError(remoting.Error.UNEXPECTED);
296 } 295 }
297 break; 296 break;
298 297
299 case 'getDaemonStateResponse': 298 case 'getDaemonStateResponse':
300 var state = asHostState_(message['state']); 299 var state = asHostState_(message['state']);
301 if (state != null) { 300 if (state != null) {
302 callback(state); 301 onDone(state);
303 } else { 302 } else {
304 onError(remoting.Error.UNEXPECTED); 303 onError(remoting.Error.UNEXPECTED);
305 } 304 }
306 break; 305 break;
307 306
308 case 'getPairedClientsResponse': 307 case 'getPairedClientsResponse':
309 var pairedClients = remoting.PairedClient.convertToPairedClientArray( 308 var pairedClients = remoting.PairedClient.convertToPairedClientArray(
310 message['pairedClients']); 309 message['pairedClients']);
311 if (pairedClients != null) { 310 if (pairedClients != null) {
312 callback(pairedClients); 311 onDone(pairedClients);
313 } else { 312 } else {
314 onError(remoting.Error.UNEXPECTED); 313 onError(remoting.Error.UNEXPECTED);
315 } 314 }
316 break; 315 break;
317 316
318 case 'clearPairedClientsResponse': 317 case 'clearPairedClientsResponse':
319 case 'deletePairedClientResponse': 318 case 'deletePairedClientResponse':
320 /** @type {boolean} */ 319 /** @type {boolean} */
321 var success = message['result']; 320 var success = message['result'];
322 if (checkType_('success', success, 'boolean')) { 321 if (checkType_('success', success, 'boolean')) {
323 callback(success); 322 onDone(success);
324 } else { 323 } else {
325 onError(remoting.Error.UNEXPECTED); 324 onError(remoting.Error.UNEXPECTED);
326 } 325 }
327 break; 326 break;
328 327
329 default: 328 default:
330 console.error('Unexpected native message: ', message); 329 console.error('Unexpected native message: ', message);
331 onError(remoting.Error.UNEXPECTED); 330 onError(remoting.Error.UNEXPECTED);
332 } 331 }
333 }; 332 };
334 333
335 /** 334 /**
336 * @return {void} Nothing. 335 * @return {void} Nothing.
337 * @private 336 * @private
338 */ 337 */
339 remoting.HostNativeMessaging.prototype.onDisconnect_ = function() { 338 remoting.HostNativeMessaging.prototype.onDisconnect_ = function() {
340 console.error('Native Message port disconnected'); 339 console.error('Native Message port disconnected');
341 340
342 // Notify the error-handlers of any requests that are still outstanding. 341 // Notify the error-handlers of any requests that are still outstanding.
343 for (var id in this.pendingReplies_) { 342 for (var id in this.pendingReplies_) {
344 this.pendingReplies_[/** @type {number} */(id)].onError( 343 this.pendingReplies_[/** @type {number} */(id)].onError(
345 remoting.Error.UNEXPECTED); 344 remoting.Error.UNEXPECTED);
346 } 345 }
347 this.pendingReplies_ = {}; 346 this.pendingReplies_ = {};
348 } 347 }
349 348
350 /** 349 /**
351 * @param {function(string):void} callback Callback to be called with the 350 * @param {function(string):void} onDone Callback to be called with the
352 * local hostname. 351 * local hostname.
353 * @param {function(remoting.Error):void} onError The callback to be triggered 352 * @param {function(remoting.Error):void} onError The callback to be triggered
354 * on error. 353 * on error.
355 * @return {void} Nothing. 354 * @return {void} Nothing.
356 */ 355 */
357 remoting.HostNativeMessaging.prototype.getHostName = function(callback, 356 remoting.HostNativeMessaging.prototype.getHostName =
358 onError) { 357 function(onDone, onError) {
359 this.postMessage_({type: 'getHostName'}, callback, onError); 358 this.postMessage_({type: 'getHostName'}, onDone, onError);
360 }; 359 };
361 360
362 /** 361 /**
363 * Calculates PIN hash value to be stored in the config, passing the resulting 362 * Calculates PIN hash value to be stored in the config, passing the resulting
364 * hash value base64-encoded to the callback. 363 * hash value base64-encoded to the callback.
365 * 364 *
366 * @param {string} hostId The host ID. 365 * @param {string} hostId The host ID.
367 * @param {string} pin The PIN. 366 * @param {string} pin The PIN.
368 * @param {function(string):void} callback Callback. 367 * @param {function(string):void} onDone Callback.
369 * @param {function(remoting.Error):void} onError The callback to be triggered 368 * @param {function(remoting.Error):void} onError The callback to be triggered
370 * on error. 369 * on error.
371 * @return {void} Nothing. 370 * @return {void} Nothing.
372 */ 371 */
373 remoting.HostNativeMessaging.prototype.getPinHash = function(hostId, pin, 372 remoting.HostNativeMessaging.prototype.getPinHash =
374 callback, 373 function(hostId, pin, onDone, onError) {
375 onError) {
376 this.postMessage_({ 374 this.postMessage_({
377 type: 'getPinHash', 375 type: 'getPinHash',
378 hostId: hostId, 376 hostId: hostId,
379 pin: pin 377 pin: pin
380 }, callback, onError); 378 }, onDone, onError);
381 }; 379 };
382 380
383 /** 381 /**
384 * Generates new key pair to use for the host. The specified callback is called 382 * Generates new key pair to use for the host. The specified callback is called
385 * when the key is generated. The key is returned in format understood by the 383 * when the key is generated. The key is returned in format understood by the
386 * host (PublicKeyInfo structure encoded with ASN.1 DER, and then BASE64). 384 * host (PublicKeyInfo structure encoded with ASN.1 DER, and then BASE64).
387 * 385 *
388 * @param {function(string, string):void} callback Callback. 386 * @param {function(string, string):void} onDone Callback.
389 * @param {function(remoting.Error):void} onError The callback to be triggered 387 * @param {function(remoting.Error):void} onError The callback to be triggered
390 * on error. 388 * on error.
391 * @return {void} Nothing. 389 * @return {void} Nothing.
392 */ 390 */
393 remoting.HostNativeMessaging.prototype.generateKeyPair = function(callback, 391 remoting.HostNativeMessaging.prototype.generateKeyPair =
394 onError) { 392 function(onDone, onError) {
395 this.postMessage_({type: 'generateKeyPair'}, callback, onError); 393 this.postMessage_({type: 'generateKeyPair'}, onDone, onError);
396 }; 394 };
397 395
398 /** 396 /**
399 * Updates host config with the values specified in |config|. All 397 * Updates host config with the values specified in |config|. All
400 * fields that are not specified in |config| remain 398 * fields that are not specified in |config| remain
401 * unchanged. Following parameters cannot be changed using this 399 * unchanged. Following parameters cannot be changed using this
402 * function: host_id, xmpp_login. Error is returned if |config| 400 * function: host_id, xmpp_login. Error is returned if |config|
403 * includes these parameters. Changes take effect before the callback 401 * includes these parameters. Changes take effect before the callback
404 * is called. 402 * is called.
405 * 403 *
406 * @param {Object} config The new config parameters. 404 * @param {Object} config The new config parameters.
407 * @param {function(remoting.HostController.AsyncResult):void} callback 405 * @param {function(remoting.HostController.AsyncResult):void} onDone
408 * Callback to be called when finished. 406 * Callback to be called when finished.
409 * @param {function(remoting.Error):void} onError The callback to be triggered 407 * @param {function(remoting.Error):void} onError The callback to be triggered
410 * on error. 408 * on error.
411 * @return {void} Nothing. 409 * @return {void} Nothing.
412 */ 410 */
413 remoting.HostNativeMessaging.prototype.updateDaemonConfig = 411 remoting.HostNativeMessaging.prototype.updateDaemonConfig =
414 function(config, callback, onError) { 412 function(config, onDone, onError) {
415 this.postMessage_({ 413 this.postMessage_({
416 type: 'updateDaemonConfig', 414 type: 'updateDaemonConfig',
417 config: config 415 config: config
418 }, callback, onError); 416 }, onDone, onError);
419 }; 417 };
420 418
421 /** 419 /**
422 * Loads daemon config. The config is passed as a JSON formatted string to the 420 * Loads daemon config. The config is passed as a JSON formatted string to the
423 * callback. 421 * callback.
424 * 422 *
425 * @param {function(Object):void} callback Callback. 423 * @param {function(Object):void} onDone Callback.
426 * @param {function(remoting.Error):void} onError The callback to be triggered 424 * @param {function(remoting.Error):void} onError The callback to be triggered
427 * on error. 425 * on error.
428 * @return {void} Nothing. 426 * @return {void} Nothing.
429 */ 427 */
430 remoting.HostNativeMessaging.prototype.getDaemonConfig = function(callback, 428 remoting.HostNativeMessaging.prototype.getDaemonConfig =
431 onError) { 429 function(onDone, onError) {
432 this.postMessage_({type: 'getDaemonConfig'}, callback, onError); 430 this.postMessage_({type: 'getDaemonConfig'}, onDone, onError);
433 }; 431 };
434 432
435 /** 433 /**
436 * Retrieves daemon version. The version is returned as a dotted decimal string 434 * Retrieves daemon version. The version is returned as a dotted decimal string
437 * of the form major.minor.build.patch. 435 * of the form major.minor.build.patch.
438 * @return {string} The daemon version, or the empty string if not available. 436 * @return {string} The daemon version, or the empty string if not available.
439 */ 437 */
440 remoting.HostNativeMessaging.prototype.getDaemonVersion = function() { 438 remoting.HostNativeMessaging.prototype.getDaemonVersion = function() {
441 // Return the cached version from the 'hello' exchange. 439 // Return the cached version from the 'hello' exchange.
442 return this.version_; 440 return this.version_;
443 }; 441 };
444 442
445 /** 443 /**
446 * Get the user's consent to crash reporting. The consent flags are passed to 444 * Get the user's consent to crash reporting. The consent flags are passed to
447 * the callback as booleans: supported, allowed, set-by-policy. 445 * the callback as booleans: supported, allowed, set-by-policy.
448 * 446 *
449 * @param {function(boolean, boolean, boolean):void} callback Callback. 447 * @param {function(boolean, boolean, boolean):void} onDone Callback.
450 * @param {function(remoting.Error):void} onError The callback to be triggered 448 * @param {function(remoting.Error):void} onError The callback to be triggered
451 * on error. 449 * on error.
452 * @return {void} Nothing. 450 * @return {void} Nothing.
453 */ 451 */
454 remoting.HostNativeMessaging.prototype.getUsageStatsConsent = 452 remoting.HostNativeMessaging.prototype.getUsageStatsConsent =
455 function(callback, onError) { 453 function(onDone, onError) {
456 this.postMessage_({type: 'getUsageStatsConsent'}, callback, onError); 454 this.postMessage_({type: 'getUsageStatsConsent'}, onDone, onError);
457 }; 455 };
458 456
459 /** 457 /**
460 * Starts the daemon process with the specified configuration. 458 * Starts the daemon process with the specified configuration.
461 * 459 *
462 * @param {Object} config Host configuration. 460 * @param {Object} config Host configuration.
463 * @param {boolean} consent Consent to report crash dumps. 461 * @param {boolean} consent Consent to report crash dumps.
464 * @param {function(remoting.HostController.AsyncResult):void} callback 462 * @param {function(remoting.HostController.AsyncResult):void} onDone
465 * Callback. 463 * Callback.
466 * @param {function(remoting.Error):void} onError The callback to be triggered 464 * @param {function(remoting.Error):void} onError The callback to be triggered
467 * on error. 465 * on error.
468 * @return {void} Nothing. 466 * @return {void} Nothing.
469 */ 467 */
470 remoting.HostNativeMessaging.prototype.startDaemon = function( 468 remoting.HostNativeMessaging.prototype.startDaemon =
471 config, consent, callback, onError) { 469 function(config, consent, onDone, onError) {
472 this.postMessage_({ 470 this.postMessage_({
473 type: 'startDaemon', 471 type: 'startDaemon',
474 config: config, 472 config: config,
475 consent: consent 473 consent: consent
476 }, callback, onError); 474 }, onDone, onError);
477 }; 475 };
478 476
479 /** 477 /**
480 * Stops the daemon process. 478 * Stops the daemon process.
481 * 479 *
482 * @param {function(remoting.HostController.AsyncResult):void} callback 480 * @param {function(remoting.HostController.AsyncResult):void} onDone
483 * Callback. 481 * Callback.
484 * @param {function(remoting.Error):void} onError The callback to be triggered 482 * @param {function(remoting.Error):void} onError The callback to be triggered
485 * on error. 483 * on error.
486 * @return {void} Nothing. 484 * @return {void} Nothing.
487 */ 485 */
488 remoting.HostNativeMessaging.prototype.stopDaemon = function(callback, 486 remoting.HostNativeMessaging.prototype.stopDaemon =
489 onError) { 487 function(onDone, onError) {
490 this.postMessage_({type: 'stopDaemon'}, callback, onError); 488 this.postMessage_({type: 'stopDaemon'}, onDone, onError);
491 }; 489 };
492 490
493 /** 491 /**
494 * Gets the installed/running state of the Host process. 492 * Gets the installed/running state of the Host process.
495 * 493 *
496 * @param {function(remoting.HostController.State):void} callback Callback. 494 * @param {function(remoting.HostController.State):void} onDone Callback.
497 * @param {function(remoting.Error):void} onError The callback to be triggered 495 * @param {function(remoting.Error):void} onError The callback to be triggered
498 * on error. 496 * on error.
499 * @return {void} Nothing. 497 * @return {void} Nothing.
500 */ 498 */
501 remoting.HostNativeMessaging.prototype.getDaemonState = function(callback, 499 remoting.HostNativeMessaging.prototype.getDaemonState =
502 onError) { 500 function(onDone, onError) {
503 this.postMessage_({type: 'getDaemonState'}, callback, onError); 501 this.postMessage_({type: 'getDaemonState'}, onDone, onError);
504 } 502 }
505 503
506 /** 504 /**
507 * Retrieves the list of paired clients. 505 * Retrieves the list of paired clients.
508 * 506 *
509 * @param {function(Array.<remoting.PairedClient>):void} onDone Callback to be 507 * @param {function(Array.<remoting.PairedClient>):void} onDone Callback to be
510 * called with the result. 508 * called with the result.
511 * @param {function(remoting.Error):void} onError Callback to be triggered 509 * @param {function(remoting.Error):void} onError Callback to be triggered
512 * on error. 510 * on error.
513 */ 511 */
(...skipping 22 matching lines...) Expand all
536 * @param {function(remoting.Error):void} onError Callback to be triggered 534 * @param {function(remoting.Error):void} onError Callback to be triggered
537 * on error. 535 * on error.
538 */ 536 */
539 remoting.HostNativeMessaging.prototype.deletePairedClient = 537 remoting.HostNativeMessaging.prototype.deletePairedClient =
540 function(client, onDone, onError) { 538 function(client, onDone, onError) {
541 this.postMessage_({ 539 this.postMessage_({
542 type: 'deletePairedClient', 540 type: 'deletePairedClient',
543 clientId: client 541 clientId: client
544 }, onDone, onError); 542 }, onDone, onError);
545 } 543 }
OLDNEW
« no previous file with comments | « remoting/webapp/host_dispatcher.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698