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

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

Issue 1179323005: Polymer upgraded to 1.0 in login flow. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@polymer_pre_migration
Patch Set: Comments addressed. Created 5 years, 6 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 */
5 4
6 Polymer('gaia-input-form', (function() { 5 Polymer({
7 return { 6 is: 'gaia-input-form',
8 onButtonClicked: function() { 7
9 this.fire('submit'); 8 properties: {
9 disabled: {
10 type: Boolean,
11 observer: 'onDisabledChanged_',
10 }, 12 },
11 13
12 onKeyDown: function(e) { 14 buttonText: String
13 if (e.keyCode == 13 && !this.$.button.disabled) 15 },
14 this.onButtonClicked();
15 },
16 16
17 set disabled(value) { 17 onButtonClicked_: function() {
18 var controls = this.querySelectorAll( 18 this.fire('submit');
19 ':host /deep/ [role="button"], :host /deep/ [is="core-input"]'); 19 },
20 for (var i = 0, control; control = controls[i]; ++i) 20
21 control.disabled = value; 21 getInputs_: function() {
22 }, 22 return Polymer.dom(this.$.inputs).getDistributedNodes();
23 }; 23 },
24 })()); 24
25 onKeyDown_: function(e) {
26 if (e.keyCode != 13 || this.$.button.disabled)
27 return;
28 if (this.getInputs_().indexOf(e.target) == -1)
29 return;
30 this.onButtonClicked_();
31 },
32
33 getControls_: function() {
34 var controls = this.getInputs_();
35 controls.push(this.$.button);
36 return controls.concat(Polymer.dom(this).querySelectorAll('gaia-button'));
37 },
38
39 onDisabledChanged_: function(disabled) {
40 this.getControls_().forEach(function(control) {
41 control.disabled = disabled;
42 });
43 }
44 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698