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

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

Issue 807503004: While trying to enable webview sign-in by default, I found a bunch of issues (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebased Created 6 years 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/inline_login/inline_login.js
diff --git a/chrome/browser/resources/inline_login/inline_login.js b/chrome/browser/resources/inline_login/inline_login.js
index ec86c444d1197f81f1cfe23989d2a73ed7f0bd1a..96a0bb22b1ff1f89cd5ac89ee5ef738a5e3f3579 100644
--- a/chrome/browser/resources/inline_login/inline_login.js
+++ b/chrome/browser/resources/inline_login/inline_login.js
@@ -20,47 +20,25 @@ cr.define('inline.login', function() {
*/
var authReadyFired;
- /**
- * A listener class for authentication events from GaiaAuthHost.
- * @constructor
- * @implements {cr.login.GaiaAuthHost.Listener}
- */
- function GaiaAuthHostListener() {}
-
- /** @override */
- GaiaAuthHostListener.prototype.onSuccess = function(credentials) {
- onAuthCompleted(credentials);
- };
-
- /** @override */
- GaiaAuthHostListener.prototype.onReady = function(e) {
- onAuthReady();
- };
+ function onResize(e) {
+ chrome.send('switchToFullTab', [e.detail]);
+ }
- /** @override */
- GaiaAuthHostListener.prototype.onResize = function(url) {
- chrome.send('switchToFullTab', [url]);
- };
+ function onAuthReady(e) {
+ $('contents').classList.toggle('loading', false);
+ authReadyFired = true;
+ }
- /** @override */
- GaiaAuthHostListener.prototype.onNewWindow = function(e) {
- window.open(e.targetUrl, '_blank');
+ function onNewWindow(e) {
+ window.open(e.detail.targetUrl, '_blank');
e.window.discard();
- };
+ }
- /**
- * Handler of auth host 'ready' event.
- */
- function onAuthReady() {
- $('contents').classList.toggle('loading', false);
- authReadyFired = true;
+ function onAuthCompleted(e) {
+ this.completeLogin(e.detail);
}
- /**
- * Handler of auth host 'completed' event.
- * @param {!Object} credentials Credentials of the completed authentication.
- */
- function onAuthCompleted(credentials) {
+ function completeLogin(credentials) {
chrome.send('completeLogin', [credentials]);
$('contents').classList.toggle('loading', true);
}
@@ -69,10 +47,11 @@ cr.define('inline.login', function() {
* Initialize the UI.
*/
function initialize() {
- authExtHost = new cr.login.GaiaAuthHost(
- 'signin-frame', new GaiaAuthHostListener());
+ authExtHost = new cr.login.GaiaAuthHost('signin-frame');
authExtHost.addEventListener('ready', onAuthReady);
-
+ authExtHost.addEventListener('newWindow', onNewWindow);
+ authExtHost.addEventListener('resize', onResize);
+ authExtHost.addEventListener('authCompleted', onAuthCompleted);
chrome.send('initialize');
}
@@ -81,7 +60,9 @@ cr.define('inline.login', function() {
* @param {Object} data Parameters for auth extension.
*/
function loadAuthExtension(data) {
- authExtHost.load(data.authMode, data, onAuthCompleted);
+ // TODO(rogerta): in when using webview, the |completeLogin| argument
+ // is ignored. See addEventListener() call above.
+ authExtHost.load(data.authMode, data, completeLogin);
$('contents').classList.toggle('loading',
data.authMode != cr.login.GaiaAuthHost.AuthMode.DESKTOP ||
data.constrained == '1');

Powered by Google App Engine
This is Rietveld 408576698