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

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

Issue 1129063003: <gaia-input> element extracted from <gaia-input-form>. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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/offline_gaia.js
diff --git a/chrome/browser/resources/chromeos/login/offline_gaia.js b/chrome/browser/resources/chromeos/login/offline_gaia.js
index 2da030507bb89a64d99915b0d36a1d55a438a0b1..0982594aea9fe9b410ec67f914d3db15b9392980 100644
--- a/chrome/browser/resources/chromeos/login/offline_gaia.js
+++ b/chrome/browser/resources/chromeos/login/offline_gaia.js
@@ -35,31 +35,6 @@ Polymer('offline-gaia', (function() {
}
},
- ready: function() {
- var emailInput = this.$.emailInput;
- var passwordInput = this.$.passwordInput;
- emailInput.addEventListener('buttonClick', function() {
- if (emailInput.checkValidity()) {
- this.switchToPasswordCard(emailInput.inputValue);
- } else {
- emailInput.focus();
- }
- }.bind(this));
-
- passwordInput.addEventListener('buttonClick', function() {
- if (this.$.passwordInput.checkValidity()) {
- var msg = {
- 'useOffline': true,
- 'email': this.$.passwordHeader.email,
- 'password': this.$.passwordInput.inputValue
- };
- this.$.passwordInput.inputValue = '';
- this.fire('authCompleted', msg);
- }
- }.bind(this));
-
- },
-
setEmail: function(email) {
// Reorder elements for proper animation for rtl languages.
if (document.querySelector('html[dir=rtl]')) {
@@ -70,9 +45,9 @@ Polymer('offline-gaia', (function() {
if (this.emailDomain)
email = email.replace(this.emailDomain, '');
this.switchToPasswordCard(email);
- this.$.passwordInput.setValid(false);
+ this.$.passwordInput.isInvalid = true;
} else {
- this.$.emailInput.inputValue = '';
+ this.$.emailInput.value = '';
this.switchToEmailCard();
}
},
@@ -82,15 +57,15 @@ Polymer('offline-gaia', (function() {
},
switchToEmailCard() {
- this.$.passwordInput.inputValue = '';
- this.$.passwordInput.setValid(true);
- this.$.emailInput.setValid(true);
+ this.$.passwordInput.value = '';
+ this.$.passwordInput.isInvalid = false;
+ this.$.emailInput.isInvalid = false;
this.$.backButton.hidden = true;
this.$.animatedPages.selected = 'emailSection';
},
switchToPasswordCard(email) {
- this.$.emailInput.inputValue = email;
+ this.$.emailInput.value = email;
if (email.indexOf('@') === -1) {
if (this.emailDomain)
email = email + this.emailDomain;
@@ -100,6 +75,27 @@ Polymer('offline-gaia', (function() {
this.$.passwordHeader.email = email;
this.$.backButton.hidden = false;
this.$.animatedPages.selected = 'passwordSection';
+ },
+
+ onEmailSubmitted: function() {
+ if (this.$.emailInput.checkValidity()) {
Nikita (slow) 2015/05/07 09:44:13 nit: drop {}
dzhioev (left Google) 2015/05/07 22:21:27 Done.
+ this.switchToPasswordCard(this.$.emailInput.value);
+ } else {
+ this.$.emailInput.focus();
+ }
+ },
+
+ onPasswordSubmitted: function() {
+ if (!this.$.passwordInput.checkValidity()) {
Nikita (slow) 2015/05/07 09:44:13 nit: drop {}
dzhioev (left Google) 2015/05/07 22:21:27 Done.
+ return;
+ }
+ var msg = {
+ 'useOffline': true,
+ 'email': this.$.passwordHeader.email,
+ 'password': this.$.passwordInput.value
+ };
+ this.$.passwordInput.value = '';
+ this.fire('authCompleted', msg);
}
};
})());

Powered by Google App Engine
This is Rietveld 408576698