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

Unified Diff: remoting/webapp/me2mom/remoting.js

Issue 7574019: Removed oauth2_callback.html, merged functionality into remoting.js and improved 'No thanks' UX. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Clear oauth2 results on init. Created 9 years, 4 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
« no previous file with comments | « remoting/webapp/me2mom/oauth2_callback.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/webapp/me2mom/remoting.js
diff --git a/remoting/webapp/me2mom/remoting.js b/remoting/webapp/me2mom/remoting.js
index 8947e59d0ac58e9b66f97a42ecf007097efbb800..1b5590469f0f7d425e3ec945c671e67bb214af30 100644
--- a/remoting/webapp/me2mom/remoting.js
+++ b/remoting/webapp/me2mom/remoting.js
@@ -147,6 +147,27 @@ remoting.init = function() {
remoting.debug =
new remoting.DebugLog(document.getElementById('debug-messages'));
+ // Process OAuth redirection
+ if (window.location.search) {
+ var parts = window.location.search.substring(1).split('&');
+ var queryArgs = {};
+ for (var i = 0; i < parts.length; i++) {
+ var pair = parts[i].split('=');
+ queryArgs[pair[0]] = pair[1];
+ }
+ // If this an OAuth2 redirect, then strip the parameters from the URL
+ // to prevent them getting stored in bookmarks.
+ if ('code' in queryArgs) {
+ remoting.oauth2.exchangeCodeForToken(queryArgs['code'], function() {
+ window.location.replace(chrome.extension.getURL('choice.html'));
+ });
+ return;
+ } else if ('error' in queryArgs) {
+ window.location.replace(chrome.extension.getURL('choice.html'));
+ return;
Jamie 2011/08/04 21:56:16 Does location.replace automatically terminate the
awong 2011/08/04 22:42:36 I think it does go immediately, but the return sti
+ }
+ }
+
refreshEmail_();
var email = getEmail();
if (email) {
« no previous file with comments | « remoting/webapp/me2mom/oauth2_callback.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698