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

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

Issue 1110493002: ChromeOS Gaia: UI polishing (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Changed line-height for gaia-body-text 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 unified diff | Download patch
OLDNEW
1 /* Copyright 2015 The Chromium Authors. All rights reserved. 1 /* Copyright 2015 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 Polymer('offline-gaia', (function() { 6 Polymer('offline-gaia', (function() {
7 var DEFAULT_EMAIL_DOMAIN = '@gmail.com';
8
7 return { 9 return {
8 onTransitionEnd: function() { 10 onTransitionEnd: function() {
9 this.focus(); 11 this.focus();
10 }, 12 },
11 13
12 focus: function() { 14 focus: function() {
13 if (this.$.animatedPages.selected == 0) 15 if (this.$.animatedPages.selected == 0)
14 this.$.emailInput.focus(); 16 this.$.emailInput.focus();
15 else 17 else
16 this.$.passwordInput.focus(); 18 this.$.passwordInput.focus();
(...skipping 24 matching lines...) Expand all
41 this.switchToPasswordCard(emailInput.inputValue); 43 this.switchToPasswordCard(emailInput.inputValue);
42 } else { 44 } else {
43 emailInput.focus(); 45 emailInput.focus();
44 } 46 }
45 }.bind(this)); 47 }.bind(this));
46 48
47 passwordInput.addEventListener('buttonClick', function() { 49 passwordInput.addEventListener('buttonClick', function() {
48 if (this.$.passwordInput.checkValidity()) { 50 if (this.$.passwordInput.checkValidity()) {
49 var msg = { 51 var msg = {
50 'useOffline': true, 52 'useOffline': true,
51 'email': this.$.emailInput.inputValue, 53 'email': this.$.passwordHeader.email,
52 'password': this.$.passwordInput.inputValue 54 'password': this.$.passwordInput.inputValue
53 }; 55 };
54 this.$.passwordInput.inputValue = ''; 56 this.$.passwordInput.inputValue = '';
55 this.fire('authCompleted', msg); 57 this.fire('authCompleted', msg);
56 } 58 }
57 }.bind(this)); 59 }.bind(this));
58 60
59 }, 61 },
60 62
61 setEmail: function(email) { 63 setEmail: function(email) {
62 if (email) { 64 if (email) {
65 if (this.emailDomain)
66 email = email.replace(this.emailDomain, '');
63 this.switchToPasswordCard(email); 67 this.switchToPasswordCard(email);
64 this.$.passwordInput.setValid(false); 68 this.$.passwordInput.setValid(false);
65 } else { 69 } else {
66 this.$.emailInput.inputValue = ''; 70 this.$.emailInput.inputValue = '';
67 this.switchToEmailCard(); 71 this.switchToEmailCard();
68 } 72 }
69 }, 73 },
70 74
71 onBack: function() { 75 onBack: function() {
72 this.switchToEmailCard(); 76 this.switchToEmailCard();
73 }, 77 },
74 78
75 switchToEmailCard() { 79 switchToEmailCard() {
76 this.$.passwordInput.inputValue = ''; 80 this.$.passwordInput.inputValue = '';
77 this.$.passwordInput.setValid(true); 81 this.$.passwordInput.setValid(true);
78 this.$.emailInput.setValid(true); 82 this.$.emailInput.setValid(true);
79 this.$.backButton.hidden = true; 83 this.$.backButton.hidden = true;
80 this.$.animatedPages.selected = 0; 84 this.$.animatedPages.selected = 0;
81 }, 85 },
82 86
83 switchToPasswordCard(email) { 87 switchToPasswordCard(email) {
84 this.$.emailInput.inputValue = email; 88 this.$.emailInput.inputValue = email;
89 if (email.indexOf('@') === -1) {
90 if (this.emailDomain)
91 email = email + this.emailDomain;
92 else
93 email = email + DEFAULT_EMAIL_DOMAIN;
94 }
85 this.$.passwordHeader.email = email; 95 this.$.passwordHeader.email = email;
86 this.$.backButton.hidden = false; 96 this.$.backButton.hidden = false;
87 this.$.animatedPages.selected = 1; 97 this.$.animatedPages.selected = 1;
88 } 98 }
89 }; 99 };
90 })()); 100 })());
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698