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

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

Issue 12905012: Webapp changes to support third party authentication (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 7 years, 9 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 /** @type {remoting.HostSession} */ remoting.hostSession = null; 10 /** @type {remoting.HostSession} */ remoting.hostSession = null;
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after
349 } else { 349 } else {
350 chrome.windows.get(tab.windowId, null, windowCallback); 350 chrome.windows.get(tab.windowId, null, windowCallback);
351 } 351 }
352 }; 352 };
353 if (chrome.tabs) { 353 if (chrome.tabs) {
354 chrome.tabs.getCurrent(tabCallback); 354 chrome.tabs.getCurrent(tabCallback);
355 } else { 355 } else {
356 console.error('chome.tabs is not available.'); 356 console.error('chome.tabs is not available.');
357 } 357 }
358 } 358 }
359
360 /**
361 * Generate a nonce, to be used as an xsrf protection token.
362 *
363 * @return {string} A URL-Safe Base64-encoded 128-bit random value. */
364 remoting.generateXsrfToken = function() {
365 var random = new Uint8Array(16);
366 window.crypto.getRandomValues(random);
367 var base64Token = window.btoa(String.fromCharCode.apply(null, random));
368 return base64Token.replace(/\+/g, '-').replace(/\//g, '_').replace(/=/g, '');
369 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698