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

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

Issue 687873003: Allow the background page to get an OAuth token for apps v1. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Move jsonParseSafe into base namespace. Created 6 years, 1 month 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
« no previous file with comments | « remoting/webapp/crd/js/event_handlers.js ('k') | remoting/webapp/crd/js/host_list.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 * @param {string} hostName 233 * @param {string} hostName
234 * @param {string} publicKey 234 * @param {string} publicKey
235 * @param {string} privateKey 235 * @param {string} privateKey
236 * @param {XMLHttpRequest} xhr 236 * @param {XMLHttpRequest} xhr
237 */ 237 */
238 function onRegistered( 238 function onRegistered(
239 hostName, publicKey, privateKey, xhr) { 239 hostName, publicKey, privateKey, xhr) {
240 var success = (xhr.status == 200); 240 var success = (xhr.status == 200);
241 241
242 if (success) { 242 if (success) {
243 var result = jsonParseSafe(xhr.responseText); 243 var result = base.jsonParseSafe(xhr.responseText);
244 if ('data' in result && 'authorizationCode' in result['data']) { 244 if ('data' in result && 'authorizationCode' in result['data']) {
245 that.hostDaemonFacade_.getCredentialsFromAuthCode( 245 that.hostDaemonFacade_.getCredentialsFromAuthCode(
246 result['data']['authorizationCode'], 246 result['data']['authorizationCode'],
247 onServiceAccountCredentials.bind( 247 onServiceAccountCredentials.bind(
248 null, hostName, publicKey, privateKey), 248 null, hostName, publicKey, privateKey),
249 onError); 249 onError);
250 } else { 250 } else {
251 // No authorization code returned, use regular user credential flow. 251 // No authorization code returned, use regular user credential flow.
252 that.hostDaemonFacade_.getPinHash( 252 that.hostDaemonFacade_.getPinHash(
253 newHostId, hostPin, startHostWithHash.bind( 253 newHostId, hostPin, startHostWithHash.bind(
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after
568 function connectSignalingWithTokenAndEmail(token, email) { 568 function connectSignalingWithTokenAndEmail(token, email) {
569 signalStrategy.connect( 569 signalStrategy.connect(
570 remoting.settings.XMPP_SERVER_ADDRESS, email, token); 570 remoting.settings.XMPP_SERVER_ADDRESS, email, token);
571 } 571 }
572 572
573 remoting.identity.callWithToken(connectSignalingWithToken, onError); 573 remoting.identity.callWithToken(connectSignalingWithToken, onError);
574 }; 574 };
575 575
576 /** @type {remoting.HostController} */ 576 /** @type {remoting.HostController} */
577 remoting.hostController = null; 577 remoting.hostController = null;
OLDNEW
« no previous file with comments | « remoting/webapp/crd/js/event_handlers.js ('k') | remoting/webapp/crd/js/host_list.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698