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 82ed0922e3901cb5189d3e1094a7eaac535ac2a8..fe41e0b1b937a3773efdbc53899b3c4932a42a7a 100644 |
--- a/chrome/browser/resources/inline_login/inline_login.js |
+++ b/chrome/browser/resources/inline_login/inline_login.js |
@@ -6,14 +6,12 @@ |
* @fileoverview Inline login UI. |
*/ |
-<include src="../gaia_auth_host/gaia_auth_host.js"> |
- |
cr.define('inline.login', function() { |
'use strict'; |
/** |
* The auth extension host instance. |
- * @type {Object} |
+ * @type {cr.login.GaiaAuthHost} |
*/ |
var authExtHost; |
@@ -23,6 +21,34 @@ 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(); |
+ }; |
+ |
+ /** @override */ |
+ GaiaAuthHostListener.prototype.onResize = function(url) { |
+ chrome.send('switchToFullTab', url); |
+ }; |
+ |
+ /** @override */ |
+ GaiaAuthHostListener.prototype.onNewWindow = function(e) { |
+ window.open(e.targetUrl, '_blank'); |
+ e.window.discard(); |
+ }; |
+ |
+ /** |
* Handler of auth host 'ready' event. |
*/ |
function onAuthReady() { |
@@ -43,7 +69,8 @@ cr.define('inline.login', function() { |
* Initialize the UI. |
*/ |
function initialize() { |
- authExtHost = new cr.login.GaiaAuthHost('signin-frame'); |
+ authExtHost = new cr.login.GaiaAuthHost( |
+ 'signin-frame', new GaiaAuthHostListener()); |
authExtHost.addEventListener('ready', onAuthReady); |
chrome.send('initialize'); |