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

Unified Diff: chrome/browser/resources/chromeos/login/screen_signin.js

Issue 7980012: [ChromeOS] Reland - Make WebUI login use only needed resources. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 3 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/resources/chromeos/login/screen_signin.js
diff --git a/chrome/browser/resources/chromeos/login/screen_signin.js b/chrome/browser/resources/chromeos/login/screen_signin.js
deleted file mode 100644
index e7e6b3485f714ff7c17b17f7aab4512332c1b1d7..0000000000000000000000000000000000000000
--- a/chrome/browser/resources/chromeos/login/screen_signin.js
+++ /dev/null
@@ -1,163 +0,0 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-/**
- * @fileoverview Oobe signin screen implementation.
- */
-
-cr.define('login', function() {
- /**
- * Creates a new sign in screen div.
- * @constructor
- * @extends {HTMLDivElement}
- */
- var SigninScreen = cr.ui.define('div');
-
- // Constants for sign in screen states
- SigninScreen.STATE_INPUT = 0;
- SigninScreen.STATE_AUTHENTICATING = 1;
-
- /**
- * Registers with Oobe.
- */
- SigninScreen.register = function() {
- var screen = $('signin');
- SigninScreen.decorate(screen);
- Oobe.getInstance().registerScreen(screen);
- };
-
- SigninScreen.prototype = {
- __proto__: HTMLDivElement.prototype,
-
- /** @inheritDoc */
- decorate: function() {
- $('email').addEventListener('keydown', this.handleKeyDown_.bind(this));
- $('email').addEventListener('blur', this.handleEmailBlur_);
- $('password').addEventListener('keydown', this.handleKeyDown_.bind(this));
- },
-
- /**
- * Header text of the screen.
- * @type {string}
- */
- get header() {
- return localStrings.getString('signinScreenTitle');
- },
-
- /**
- * Buttons in oobe wizard's button strip.
- * @type {array} Array of Buttons.
- */
- get buttons() {
- var buttons = [];
-
- var signinButton = this.ownerDocument.createElement('button');
- signinButton.id = 'signin-button';
- signinButton.textContent = localStrings.getString('signinButton');
- signinButton.addEventListener('click',
- this.handleSigninClick_.bind(this));
- buttons.push(signinButton);
-
- return buttons;
- },
-
- /**
- * Helper function to toggle spinner and input fields.
- * @param {boolean} enable True to enable credential input UI.
- * @private
- */
- enableInputs_: function(enable) {
- $('login-spinner').hidden = enable;
- $('email').hidden = !enable;
- $('password').hidden = !enable;
- $('signin-button').hidden = !enable;
- },
-
- /**
- * Sets UI state.
- */
- set state(newState) {
- if (newState == SigninScreen.STATE_INPUT) {
- this.enableInputs_(true);
- } else if (newState == SigninScreen.STATE_AUTHENTICATING) {
- this.enableInputs_(false);
- }
- },
-
- /**
- * Clears input fields and switches to input mode.
- * @param {boolean} takeFocus True to take focus.
- */
- reset: function(takeFocus) {
- $('email').value = '';
- $('password').value = '';
- this.state = SigninScreen.STATE_INPUT;
-
- if (takeFocus)
- $('email').focus();
- },
-
- /**
- * Validates input fields.
- */
- checkInput: function() {
- // Validate input.
- if (!$('email').value) {
- $('email').focus();
- return false;
- }
-
- if (!$('password').value) {
- $('password').focus();
- return false;
- }
-
- return true;
- },
-
- /**
- * Handles sign in button click.
- * @private
- */
- handleSigninClick_: function(e) {
- if (!this.checkInput())
- return;
-
- this.state = SigninScreen.STATE_AUTHENTICATING;
-
- chrome.send('authenticateUser',
- [$('email').value, $('password').value]);
- },
-
- /**
- * Handles keyboard event.
- * @private
- */
- handleKeyDown_: function(e) {
- // Handle 'Enter' key for 'email' and 'password' field.
- if (e.keyIdentifier == 'Enter') {
- if (e.target.id == 'email') {
- if (e.target.value)
- $('password').focus();
- } else if (e.target.id == 'password') {
- this.handleSigninClick_();
- }
- }
- },
-
- /**
- * Handles blur event of email field.
- * @private
- */
- handleEmailBlur_: function(e) {
- var emailElement = $('email');
- if (emailElement.value && emailElement.value.indexOf('@') == -1)
- emailElement.value += '@gmail.com';
- }
- };
-
- return {
- SigninScreen: SigninScreen
- };
-});
« no previous file with comments | « chrome/browser/resources/chromeos/login/screen_signin.html ('k') | chrome/browser/resources/chromeos/login/version.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698