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

Unified Diff: chrome/browser/resources/gaia_auth_host/gaia_auth_host.js

Issue 134263005: Implement inline signin with iframe (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix for various iframe bugs Created 6 years, 10 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: chrome/browser/resources/gaia_auth_host/gaia_auth_host.js
diff --git a/chrome/browser/resources/gaia_auth_host/gaia_auth_host.js b/chrome/browser/resources/gaia_auth_host/gaia_auth_host.js
index 3acfcc36d3c7523e2217c2be4b40ae8c6356b85d..a7dadc937f781ea2cedb7e7ea830911844868081 100644
--- a/chrome/browser/resources/gaia_auth_host/gaia_auth_host.js
+++ b/chrome/browser/resources/gaia_auth_host/gaia_auth_host.js
@@ -35,12 +35,6 @@ cr.define('cr.login', function() {
var OFFLINE_AUTH_URL = AUTH_URL_BASE + '/offline.html';
/**
- * Auth URL to use for inline flow.
- * @const
- */
- var INLINE_AUTH_URL = AUTH_URL_BASE + '/inline_main.html';
-
- /**
* Origin of the gaia sign in page.
* @const
*/
@@ -59,7 +53,6 @@ cr.define('cr.login', function() {
'email', // Pre-fill the email field in Gaia UI;
'service', // Name of Gaia service;
'continueUrl', // Continue url to use;
- 'partitionId', // Partition ID for the embedded Gaia webview;
'frameUrl', // Initial frame URL to use. If empty defaults to gaiaUrl.
'constrained' // Whether the extension is loaded in a constrained window;
];
@@ -87,7 +80,7 @@ cr.define('cr.login', function() {
var AuthMode = {
DEFAULT: 0,
OFFLINE: 1,
- INLINE: 2
+ DESKTOP: 2
};
/**
@@ -111,8 +104,6 @@ cr.define('cr.login', function() {
assert(this.frame_);
window.addEventListener('message',
this.onMessage_.bind(this), false);
- window.addEventListener('popstate',
- this.onPopState_.bind(this), false);
}
GaiaAuthHost.prototype = {
@@ -140,7 +131,7 @@ cr.define('cr.login', function() {
* email: 'xx@gmail.com',
* password: 'xxxx', // May not present
* authCode: 'x/xx', // May not present
- * authMode: 'x', // Authorization mode, default/inline/offline.
+ * authMode: 'x', // Authorization mode, default/offline/desktop.
* }
* }
* </pre>
@@ -245,9 +236,9 @@ cr.define('cr.login', function() {
case AuthMode.OFFLINE:
url = OFFLINE_AUTH_URL;
break;
- case AuthMode.INLINE:
- url = INLINE_AUTH_URL;
- params.push('inlineMode=1');
+ case AuthMode.DESKTOP:
+ url = AUTH_URL;
+ params.push('desktopMode=1');
break;
default:
url = AUTH_URL;
@@ -326,17 +317,6 @@ cr.define('cr.login', function() {
onMessage_: function(e) {
var msg = e.data;
- // In the inline sign in flow, the embedded gaia webview posts credential
- // directly to the inline sign in page, because its parent JavaScript
- // reference points to the top frame of the embedder instead of the sub
- // frame of the gaia auth extension.
- if (e.origin == GAIA_ORIGIN && msg.method == 'attemptLogin') {
- this.email_ = msg.email;
- this.password_ = msg.password;
- this.chooseWhatToSync_ = msg.chooseWhatToSync;
- return;
- }
-
if (!this.isAuthExtMessage_(e))
return;
@@ -351,13 +331,13 @@ cr.define('cr.login', function() {
this.frame_.contentWindow.postMessage(msg, AUTH_URL_BASE);
return;
}
- this.onAuthSuccess_({email: msg.email || this.email_,
- password: msg.password || this.password_,
- authCode: msg.authCode,
+ this.onAuthSuccess_({email: msg.email,
+ password: msg.password,
useOffline: msg.method == 'offlineLogin',
usingSAML: msg.usingSAML || false,
- chooseWhatToSync: this.chooseWhatToSync_,
- skipForNow: msg.skipForNow || false });
+ chooseWhatToSync: msg.chooseWhatToSync,
+ skipForNow: msg.skipForNow || false,
+ sessionIndex: msg.sessionIndex || ''});
return;
}
@@ -394,39 +374,12 @@ cr.define('cr.login', function() {
return;
}
- if (msg.method == 'reportState') {
- var newUrl = setQueryParam(location, 'frameUrl', msg.src);
- if (history.state) {
- if (history.state.src != msg.src) {
- history.pushState({src: msg.src}, '', newUrl);
- }
- } else {
- history.replaceState({src: msg.src});
- }
- return;
- }
-
if (msg.method == 'switchToFullTab') {
chrome.send('switchToFullTab', [msg.url]);
return;
}
console.error('Unknown message method=' + msg.method);
- },
-
- /**
- * Event handler that is invoked when the history state is changed.
- * @param {object} e The popstate event being triggered.
- */
- onPopState_: function(e) {
- var state = e.state;
- if (state) {
- var msg = {
- method: 'navigate',
- src: state.src
- };
- this.frame_.contentWindow.postMessage(msg, AUTH_URL_BASE);
- }
}
};
« no previous file with comments | « chrome/browser/resources/gaia_auth/manifest_inline.json ('k') | chrome/browser/resources/inline_login/inline_login.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698