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

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

Issue 1094133003: Added (incomplete) implementation of HostListApi using GCD. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@gcd-client-fix
Patch Set: Created 5 years, 8 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 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 /** @type {!Promise<string>} */ 175 /** @type {!Promise<string>} */
176 var authCodePromise = Promise.all([ 176 var authCodePromise = Promise.all([
177 hostClientIdPromise, 177 hostClientIdPromise,
178 hostNamePromise, 178 hostNamePromise,
179 keyPairPromise 179 keyPairPromise
180 ]).then(function(/** Array */ a) { 180 ]).then(function(/** Array */ a) {
181 var hostClientId = /** @type {string} */ (a[0]); 181 var hostClientId = /** @type {string} */ (a[0]);
182 var hostName = /** @type {string} */ (a[1]); 182 var hostName = /** @type {string} */ (a[1]);
183 var keyPair = /** @type {remoting.KeyPair} */ (a[2]); 183 var keyPair = /** @type {remoting.KeyPair} */ (a[2]);
184 184
185 return remoting.hostListApi.register( 185 return remoting.HostListApi.getInstance().register(
186 newHostId, hostName, keyPair.publicKey, hostClientId); 186 newHostId, hostName, keyPair.publicKey, hostClientId);
187 }).then(function(/** string */ authCode) { 187 }).then(function(/** string */ result) {
188 hostRegistered = true; 188 hostRegistered = true;
189 return authCode; 189 return result;
190 }); 190 });
191 191
192 // Get XMPP creditials. 192 // Get XMPP creditials.
193 var xmppCredsPromise = authCodePromise.then(function(authCode) { 193 var xmppCredsPromise = authCodePromise.then(function(authCode) {
194 if (authCode) { 194 if (authCode) {
195 // Use auth code supplied by registry. 195 // Use auth code supplied by Chromoting registry.
196 return that.hostDaemonFacade_.getCredentialsFromAuthCode(authCode); 196 return that.hostDaemonFacade_.getCredentialsFromAuthCode(authCode);
197 } else { 197 } else {
198 // No authorization code returned, use regular Chrome 198 // No authorization code returned, use regular Chrome
199 // identitial credential flow. 199 // identity credential flow.
200 return remoting.identity.getEmail().then(function(/** string */ email) { 200 return remoting.identity.getEmail().then(function(/** string */ email) {
201 return { 201 return {
202 userEmail: email, 202 userEmail: email,
203 refreshToken: remoting.oauth2.getRefreshToken() 203 refreshToken: remoting.oauth2.getRefreshToken()
204 }; 204 };
205 }); 205 });
206 } 206 }
207 }); 207 });
208 208
209 // Get as JID to use as the host owner. 209 // Get as JID to use as the host owner.
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after
507 emailPromise.then(function(/** string */ email) { 507 emailPromise.then(function(/** string */ email) {
508 signalStrategy.connect(remoting.settings.XMPP_SERVER, email, token); 508 signalStrategy.connect(remoting.settings.XMPP_SERVER, email, token);
509 }); 509 });
510 }); 510 });
511 511
512 return result; 512 return result;
513 }; 513 };
514 514
515 /** @type {remoting.HostController} */ 515 /** @type {remoting.HostController} */
516 remoting.hostController = null; 516 remoting.hostController = null;
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698