| 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..22b1bbeafa3b3ac3c2d37f910e0d9dc1bb3d8124 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) {
|
| + 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');
|
|
|