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

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

Issue 7461142: [ChromeOS] Assorted WebUI login fixes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: address comment in #1 Created 9 years, 4 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 Out of the box experience flow (OOBE). 6 * @fileoverview Out of the box experience flow (OOBE).
7 * This is the main code for the OOBE WebUI implementation. 7 * This is the main code for the OOBE WebUI implementation.
8 */ 8 */
9 9
10 var localStrings = new LocalStrings(); 10 var localStrings = new LocalStrings();
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after
286 if (window.navigator.onLine) { 286 if (window.navigator.onLine) {
287 Oobe.showSigninUI(); 287 Oobe.showSigninUI();
288 } else { 288 } else {
289 $('bubble').showTextForElement($('add-user-button'), 289 $('bubble').showTextForElement($('add-user-button'),
290 localStrings.getString('addUserOfflineMessage')); 290 localStrings.getString('addUserOfflineMessage'));
291 } 291 }
292 }); 292 });
293 $('cancel-add-user-button').addEventListener('click', function(e) { 293 $('cancel-add-user-button').addEventListener('click', function(e) {
294 this.hidden = true; 294 this.hidden = true;
295 $('add-user-button').hidden = false; 295 $('add-user-button').hidden = false;
296 Oobe.showScreen({id: 'account-picker'}); 296 Oobe.showScreen({id: SCREEN_ACCOUNT_PICKER});
297 }); 297 });
298 298
299 document.addEventListener('keydown', function(e) { 299 document.addEventListener('keydown', function(e) {
300 Oobe.getInstance().oobeKeyDown(e); 300 Oobe.getInstance().oobeKeyDown(e);
301 }, true); 301 }, true);
302 302
303 chrome.send('screenStateInitialize', []); 303 chrome.send('screenStateInitialize', []);
304 }; 304 };
305 305
306 /** 306 /**
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
450 */ 450 */
451 Oobe.resetSigninUI = function() { 451 Oobe.resetSigninUI = function() {
452 var currentScreenId = Oobe.getInstance().currentScreen.id; 452 var currentScreenId = Oobe.getInstance().currentScreen.id;
453 if (localStrings.getString('authType') == 'webui') 453 if (localStrings.getString('authType') == 'webui')
454 $('signin').reset(currentScreenId == SCREEN_SIGNIN); 454 $('signin').reset(currentScreenId == SCREEN_SIGNIN);
455 $('pod-row').reset(currentScreenId == SCREEN_ACCOUNT_PICKER); 455 $('pod-row').reset(currentScreenId == SCREEN_ACCOUNT_PICKER);
456 }; 456 };
457 457
458 /** 458 /**
459 * Shows sign-in error bubble. 459 * Shows sign-in error bubble.
460 * @param {number} loginAttempts Number of login attemps tried.
460 * @param {string} message Error message to show. 461 * @param {string} message Error message to show.
461 * @param {string} link Text to use for help link. 462 * @param {string} link Text to use for help link.
462 * @param {number} helpId Help topic Id associated with help link. 463 * @param {number} helpId Help topic Id associated with help link.
463 */ 464 */
464 Oobe.showSignInError = function(message, link, helpId) { 465 Oobe.showSignInError = function(loginAttempts, message, link, helpId) {
465 var currentScreenId = Oobe.getInstance().currentScreen.id; 466 var currentScreenId = Oobe.getInstance().currentScreen.id;
466 var anchor = undefined; 467 var anchor = undefined;
467 if (currentScreenId == SCREEN_SIGNIN) { 468 if (currentScreenId == SCREEN_SIGNIN) {
468 anchor = $('email'); 469 anchor = $('email');
469 470
470 // Show email field so that bubble shows up at the right location. 471 // Show email field so that bubble shows up at the right location.
471 $('signin').reset(true); 472 $('signin').reset(true);
472 } else if (currentScreenId == SCREEN_ACCOUNT_PICKER && 473 } else if (currentScreenId == SCREEN_ACCOUNT_PICKER &&
473 $('pod-row').activated) { 474 $('pod-row').activated) {
475 const MAX_LOGIN_ATTEMMPTS_IN_POD = 3;
476 if (loginAttempts > MAX_LOGIN_ATTEMMPTS_IN_POD) {
477 Oobe.showSigninUI($('pod-row').activated.user.emailAddress);
478 return;
479 }
480
474 anchor = $('pod-row').activated.mainInput; 481 anchor = $('pod-row').activated.mainInput;
475 } 482 }
476 if (!anchor) { 483 if (!anchor) {
477 console.log('Warning: Failed to find anchor element for error :' + 484 console.log('Warning: Failed to find anchor element for error :' +
478 message); 485 message);
479 return; 486 return;
480 } 487 }
481 488
482 var error = document.createElement('div'); 489 var error = document.createElement('div');
483 490
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
531 document.onselectstart = function(e) { 538 document.onselectstart = function(e) {
532 e.preventDefault(); 539 e.preventDefault();
533 } 540 }
534 541
535 // Disable dragging. 542 // Disable dragging.
536 document.ondragstart = function(e) { 543 document.ondragstart = function(e) {
537 e.preventDefault(); 544 e.preventDefault();
538 } 545 }
539 546
540 document.addEventListener('DOMContentLoaded', cr.ui.Oobe.initialize); 547 document.addEventListener('DOMContentLoaded', cr.ui.Oobe.initialize);
OLDNEW
« no previous file with comments | « chrome/browser/resources/chromeos/login/oobe.css ('k') | chrome/browser/resources/chromeos/login/screen_account_picker.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698