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

Side by Side Diff: chrome/browser/resources/chromeos/login/screen_gaia_signin.js

Issue 9310050: [cros] Error bubble on login is displayed to the left of Gaia frame. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: License fixes. Created 8 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 /** 5 /**
6 * @fileoverview Oobe signin screen implementation. 6 * @fileoverview Oobe signin screen implementation.
7 */ 7 */
8 8
9 cr.define('login', function() { 9 cr.define('login', function() {
10 10
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 } else if (msg.method == 'loginUILoaded' && this.isAuthExtMessage_(e)) { 262 } else if (msg.method == 'loginUILoaded' && this.isAuthExtMessage_(e)) {
263 // TODO(altimofeev): there is no guarantee that next 'focusout' event 263 // TODO(altimofeev): there is no guarantee that next 'focusout' event
264 // will be caused by the extension, so better approach is direct asking 264 // will be caused by the extension, so better approach is direct asking
265 // the extension (and gaia consequently) to not grab the focus. 265 // the extension (and gaia consequently) to not grab the focus.
266 if (this.silentLoad_ && this.hasFocused_) { 266 if (this.silentLoad_ && this.hasFocused_) {
267 document.addEventListener( 267 document.addEventListener(
268 'focusout', this.selfBind_(this.onFocusOut_.bind(this))); 268 'focusout', this.selfBind_(this.onFocusOut_.bind(this)));
269 } 269 }
270 $('error-message').update(); 270 $('error-message').update();
271 this.loading = false; 271 this.loading = false;
272 // Show deferred error bubble.
273 if (this.errorBubble_) {
274 this.showErrorBubble(this.errorBubble_[0], this.errorBubble_[1]);
275 this.errorBubble_ = undefined;
276 }
272 this.clearRetry_(); 277 this.clearRetry_();
273 chrome.send('loginWebuiReady'); 278 chrome.send('loginWebuiReady');
274 } else if (msg.method =='offlineLogin' && this.isAuthExtMessage_(e)) { 279 } else if (msg.method =='offlineLogin' && this.isAuthExtMessage_(e)) {
275 this.email = msg.email; 280 this.email = msg.email;
276 chrome.send('authenticateUser', [msg.email, msg.password]); 281 chrome.send('authenticateUser', [msg.email, msg.password]);
277 this.loading = true; 282 this.loading = true;
278 Oobe.getInstance().headerHidden = true; 283 Oobe.getInstance().headerHidden = true;
279 } 284 }
280 }, 285 },
281 286
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
362 $('guestSignin').innerHTML = localStrings.getStringF( 367 $('guestSignin').innerHTML = localStrings.getStringF(
363 'guestSignin', 368 'guestSignin',
364 '<a id="guestSigninLink" class="signin-link" href="#">', 369 '<a id="guestSigninLink" class="signin-link" href="#">',
365 '</a>'); 370 '</a>');
366 $('createAccountLink').onclick = function() { 371 $('createAccountLink').onclick = function() {
367 chrome.send('createAccount'); 372 chrome.send('createAccount');
368 }; 373 };
369 $('guestSigninLink').onclick = function() { 374 $('guestSigninLink').onclick = function() {
370 chrome.send('launchIncognito'); 375 chrome.send('launchIncognito');
371 }; 376 };
377 },
378
379 /**
380 * Shows sign-in error bubble.
381 * @param {number} loginAttempts Number of login attemps tried.
382 * @param {HTMLElement} content Content to show in bubble.
383 */
384 showErrorBubble: function(loginAttempts, error) {
385 if (this.isLocal) {
386 $('add-user-button').hidden = true;
387 $('cancel-add-user-button').hidden = false;
388 // Reload offline version of the sign-in extension, which will show
389 // error itself.
390 chrome.send('offlineLogin', [this.email]);
391 } else if (!this.loading) {
392 $('bubble').showContentForElement($('login-box'), error,
393 cr.ui.Bubble.Attachment.LEFT);
394 } else {
395 // Defer the bubble until the frame has been loaded.
396 this.errorBubble_ = [loginAttempts, error];
397 }
372 } 398 }
373 }; 399 };
374 400
375 /** 401 /**
376 * Loads the authentication extension into the iframe. 402 * Loads the authentication extension into the iframe.
377 * @param {Object} data Extension parameters bag. 403 * @param {Object} data Extension parameters bag.
378 */ 404 */
379 GaiaSigninScreen.loadAuthExtension = function(data) { 405 GaiaSigninScreen.loadAuthExtension = function(data) {
380 $('gaia-signin').loadAuthExtension_(data); 406 $('gaia-signin').loadAuthExtension_(data);
381 }; 407 };
382 408
383 /** 409 /**
384 * Updates the authentication extension with new parameters, if needed. 410 * Updates the authentication extension with new parameters, if needed.
385 * @param {Object} data New extension parameters bag. 411 * @param {Object} data New extension parameters bag.
386 */ 412 */
387 GaiaSigninScreen.updateAuthExtension = function(data) { 413 GaiaSigninScreen.updateAuthExtension = function(data) {
388 $('gaia-signin').updateAuthExtension_(data); 414 $('gaia-signin').updateAuthExtension_(data);
389 }; 415 };
390 416
391 return { 417 return {
392 GaiaSigninScreen: GaiaSigninScreen 418 GaiaSigninScreen: GaiaSigninScreen
393 }; 419 };
394 }); 420 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698