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

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

Issue 1076093003: Added method to host daemon to exchange an auth code for just an OAuth (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
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 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 276 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 var refreshToken = base.getStringAttr(message, 'refreshToken'); 287 var refreshToken = base.getStringAttr(message, 'refreshToken');
288 if (userEmail && refreshToken) { 288 if (userEmail && refreshToken) {
289 return { 289 return {
290 userEmail: userEmail, 290 userEmail: userEmail,
291 refreshToken: refreshToken 291 refreshToken: refreshToken
292 }; 292 };
293 } else { 293 } else {
294 throw 'Missing userEmail or refreshToken'; 294 throw 'Missing userEmail or refreshToken';
295 } 295 }
296 296
297 case 'getTokenFromAuthCodeResponse':
298 var refreshToken = base.getStringAttr(message, 'refreshToken');
299 if (refreshToken) {
300 return refreshToken;
301 } else {
302 throw 'Missing refreshToken';
303 }
304
297 default: 305 default:
298 throw 'Unexpected native message: ' + message; 306 throw 'Unexpected native message: ' + message;
299 } 307 }
300 }; 308 };
301 309
302 /** 310 /**
303 * @return {void} Nothing. 311 * @return {void} Nothing.
304 * @private 312 * @private
305 */ 313 */
306 remoting.HostDaemonFacade.prototype.onDisconnect_ = function() { 314 remoting.HostDaemonFacade.prototype.onDisconnect_ = function() {
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
488 /** 496 /**
489 * Gets the API keys to obtain/use service account credentials. 497 * Gets the API keys to obtain/use service account credentials.
490 * 498 *
491 * @return {!Promise<string>} 499 * @return {!Promise<string>}
492 */ 500 */
493 remoting.HostDaemonFacade.prototype.getHostClientId = function() { 501 remoting.HostDaemonFacade.prototype.getHostClientId = function() {
494 return this.postMessage_({type: 'getHostClientId'}); 502 return this.postMessage_({type: 'getHostClientId'});
495 }; 503 };
496 504
497 /** 505 /**
498 *
499 * @param {string} authorizationCode OAuth authorization code. 506 * @param {string} authorizationCode OAuth authorization code.
500 * @return {!Promise<{remoting.XmppCredentials}>} 507 * @return {!Promise<{remoting.XmppCredentials}>}
501 */ 508 */
502 remoting.HostDaemonFacade.prototype.getCredentialsFromAuthCode = 509 remoting.HostDaemonFacade.prototype.getCredentialsFromAuthCode =
503 function(authorizationCode) { 510 function(authorizationCode) {
504 return this.postMessage_({ 511 return this.postMessage_({
505 type: 'getCredentialsFromAuthCode', 512 type: 'getCredentialsFromAuthCode',
506 authorizationCode: authorizationCode 513 authorizationCode: authorizationCode
507 }); 514 });
508 }; 515 };
516
517 /**
518 * @param {string} authorizationCode OAuth authorization code.
519 * @return {!Promise<string>}
520 */
521 remoting.HostDaemonFacade.prototype.getTokenFromAuthCode =
522 function(authorizationCode) {
523 return this.postMessage_({
524 type: 'getTokenFromAuthCode',
525 authorizationCode: authorizationCode
526 });
527 };
OLDNEW
« remoting/host/setup/oauth_client.h ('K') | « remoting/host/setup/oauth_client.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698