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

Unified Diff: remoting/webapp/crd/js/oauth2.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: Created 6 years, 2 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 side-by-side diff with in-line comments
Download patch
Index: remoting/webapp/crd/js/oauth2.js
diff --git a/remoting/webapp/crd/js/oauth2.js b/remoting/webapp/crd/js/oauth2.js
index c504a645d72d09208c141b94e18a59836b9a0334..9056c9727abf4b72b7a076f6bda9292a434776e6 100644
--- a/remoting/webapp/crd/js/oauth2.js
+++ b/remoting/webapp/crd/js/oauth2.js
@@ -237,12 +237,13 @@ remoting.OAuth2.prototype.onTokens_ =
/**
* Redirect page to get a new OAuth2 Refresh Token.
*
+ * @param {function():void} onDone Completion callback.
* @return {void} Nothing.
*/
-remoting.OAuth2.prototype.doAuthRedirect = function() {
+remoting.OAuth2.prototype.doAuthRedirect = function(onDone) {
/** @type {remoting.OAuth2} */
var that = this;
- var xsrf_token = remoting.generateXsrfToken();
+ var xsrf_token = base.generateXsrfToken();
window.localStorage.setItem(this.KEY_XSRF_TOKEN_, xsrf_token);
var GET_CODE_URL = this.getOAuth2AuthEndpoint_() + '?' +
remoting.xhr.urlencodeParamHash({
@@ -263,9 +264,6 @@ remoting.OAuth2.prototype.doAuthRedirect = function() {
*/
function oauth2MessageListener(message) {
if ('code' in message && 'state' in message) {
- var onDone = function() {
- window.location.reload();
- };
that.exchangeCodeForToken(
message['code'], message['state'], onDone);
kelvinp 2014/10/29 20:28:54 Probably need to remove onDone from line 268 as we
Jamie 2014/10/30 19:38:25 I think this is correct. We're just delegating the
kelvinp 2014/10/30 20:48:38 My bad. Face palm O_O
} else {

Powered by Google App Engine
This is Rietveld 408576698