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

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

Issue 10243011: [Chromoting] Factor out common code for pin hashing. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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 | Annotate | Revision Log
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 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 callback(result); 145 callback(result);
146 }; 146 };
147 147
148 /** @param {string} privateKey 148 /** @param {string} privateKey
149 * @param {XMLHttpRequest} xhr */ 149 * @param {XMLHttpRequest} xhr */
150 function onRegistered(privateKey, xhr) { 150 function onRegistered(privateKey, xhr) {
151 var success = (xhr.status == 200); 151 var success = (xhr.status == 200);
152 152
153 if (success) { 153 if (success) {
154 var hostSecretHash = 154 var hostSecretHash =
155 'hmac:' + that.plugin_.getPinHash(newHostId, hostPin); 155 that.plugin_.getPinHash(newHostId, hostPin);
156 var hostConfig = JSON.stringify({ 156 var hostConfig = JSON.stringify({
157 xmpp_login: remoting.oauth2.getCachedEmail(), 157 xmpp_login: remoting.oauth2.getCachedEmail(),
158 oauth_refresh_token: remoting.oauth2.exportRefreshToken(), 158 oauth_refresh_token: remoting.oauth2.exportRefreshToken(),
159 oauth_use_official_client_id: 159 oauth_use_official_client_id:
160 remoting.oauth2.USE_OFFICIAL_CLIENT_ID, 160 remoting.oauth2.USE_OFFICIAL_CLIENT_ID,
161 host_id: newHostId, 161 host_id: newHostId,
162 host_name: hostName, 162 host_name: hostName,
163 host_secret_hash: hostSecretHash, 163 host_secret_hash: hostSecretHash,
164 private_key: privateKey 164 private_key: privateKey
165 }); 165 });
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 267
268 /** @param {string} configStr */ 268 /** @param {string} configStr */
269 function onConfig(configStr) { 269 function onConfig(configStr) {
270 var config = parseHostConfig_(configStr); 270 var config = parseHostConfig_(configStr);
271 if (!config) { 271 if (!config) {
272 callback(remoting.HostController.AsyncResult.FAILED); 272 callback(remoting.HostController.AsyncResult.FAILED);
273 return; 273 return;
274 } 274 }
275 var hostId = config['host_id']; 275 var hostId = config['host_id'];
276 var newConfig = JSON.stringify({ 276 var newConfig = JSON.stringify({
277 host_secret_hash: 'hmac:' + that.plugin_.getPinHash(hostId, newPin) 277 host_secret_hash: that.plugin_.getPinHash(hostId, newPin)
278 }); 278 });
279 that.plugin_.updateDaemonConfig(newConfig, callback); 279 that.plugin_.updateDaemonConfig(newConfig, callback);
280 }; 280 };
281 281
282 // TODO(sergeyu): When crbug.com/121518 is fixed: replace this call 282 // TODO(sergeyu): When crbug.com/121518 is fixed: replace this call
283 // with an upriveleged version if that is necessary. 283 // with an upriveleged version if that is necessary.
284 this.plugin_.getDaemonConfig(onConfig); 284 this.plugin_.getDaemonConfig(onConfig);
285 }; 285 };
286 286
287 /** 287 /**
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
348 try { 348 try {
349 this.plugin_.getDaemonConfig(onConfig); 349 this.plugin_.getDaemonConfig(onConfig);
350 } catch (err) { 350 } catch (err) {
351 this.setHost(null); 351 this.setHost(null);
352 onDone(); 352 onDone();
353 } 353 }
354 }; 354 };
355 355
356 /** @type {remoting.HostController} */ 356 /** @type {remoting.HostController} */
357 remoting.hostController = null; 357 remoting.hostController = null;
OLDNEW
« remoting/host/verify_config_window_win.cc ('K') | « remoting/remoting.gyp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698