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

Side by Side Diff: remoting/webapp/crd/js/host_controller.js

Issue 1217643002: Added HostListApl implementation to connect to legacy directory and GCD. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@gcd-e2e
Patch Set: Created 5 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 'use strict'; 5 'use strict';
6 6
7 /** @suppress {duplicate} */ 7 /** @suppress {duplicate} */
8 var remoting = remoting || {}; 8 var remoting = remoting || {};
9 9
10 /** @constructor */ 10 /** @constructor */
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after
350 onConfigUpdated, remoting.Error.handler(onError)); 350 onConfigUpdated, remoting.Error.handler(onError));
351 } 351 }
352 352
353 /** @param {Object} config */ 353 /** @param {Object} config */
354 function onConfig(config) { 354 function onConfig(config) {
355 if (!isHostConfigValid_(config)) { 355 if (!isHostConfigValid_(config)) {
356 onError(remoting.Error.unexpected()); 356 onError(remoting.Error.unexpected());
357 return; 357 return;
358 } 358 }
359 /** @type {string} */ 359 /** @type {string} */
360 var hostId = config['host_id']; 360 var hostId = remoting.HostListApi.getInstance().getHostIdFromConfig(
361 /** @type {!Object} */ (config));
361 that.hostDaemonFacade_.getPinHash(hostId, newPin).then( 362 that.hostDaemonFacade_.getPinHash(hostId, newPin).then(
362 updateDaemonConfigWithHash, remoting.Error.handler(onError)); 363 updateDaemonConfigWithHash, remoting.Error.handler(onError));
363 } 364 }
364 365
365 // TODO(sergeyu): When crbug.com/121518 is fixed: replace this call 366 // TODO(sergeyu): When crbug.com/121518 is fixed: replace this call
366 // with an unprivileged version if that is necessary. 367 // with an unprivileged version if that is necessary.
367 this.hostDaemonFacade_.getDaemonConfig().then( 368 this.hostDaemonFacade_.getDaemonConfig().then(
368 onConfig, remoting.Error.handler(onError)); 369 onConfig, remoting.Error.handler(onError));
369 }; 370 };
370 371
(...skipping 19 matching lines...) Expand all
390 * 391 *
391 * @param {function(string?):void} onDone Completion callback. 392 * @param {function(string?):void} onDone Completion callback.
392 */ 393 */
393 remoting.HostController.prototype.getLocalHostId = function(onDone) { 394 remoting.HostController.prototype.getLocalHostId = function(onDone) {
394 /** @type {remoting.HostController} */ 395 /** @type {remoting.HostController} */
395 var that = this; 396 var that = this;
396 /** @param {Object} config */ 397 /** @param {Object} config */
397 function onConfig(config) { 398 function onConfig(config) {
398 var hostId = null; 399 var hostId = null;
399 if (isHostConfigValid_(config)) { 400 if (isHostConfigValid_(config)) {
400 // Use the |gcd_device_id| field if it exists, or the |host_id| 401 hostId = remoting.HostListApi.getInstance().getHostIdFromConfig(
401 // field otherwise. 402 /** @type {!Object} */ (config));
402 hostId = base.getStringAttr(
403 config, 'gcd_device_id', base.getStringAttr(config, 'host_id'));
404 } 403 }
405 onDone(hostId); 404 onDone(hostId);
406 }; 405 };
407 406
408 this.hostDaemonFacade_.getDaemonConfig().then(onConfig, function(error) { 407 this.hostDaemonFacade_.getDaemonConfig().then(onConfig, function(error) {
409 onDone(null); 408 onDone(null);
410 }); 409 });
411 }; 410 };
412 411
413 /** 412 /**
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
500 emailPromise.then(function(/** string */ email) { 499 emailPromise.then(function(/** string */ email) {
501 signalStrategy.connect(remoting.settings.XMPP_SERVER, email, token); 500 signalStrategy.connect(remoting.settings.XMPP_SERVER, email, token);
502 }); 501 });
503 }); 502 });
504 503
505 return result; 504 return result;
506 }; 505 };
507 506
508 /** @type {remoting.HostController} */ 507 /** @type {remoting.HostController} */
509 remoting.hostController = null; 508 remoting.hostController = null;
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698