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

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: {
13 if (e.keyCode == 13 && !this.$.button.disabled) 15 type: String,
14 this.onButtonClicked(); 16 reflectToAttribute: true
michaelpg 2015/06/22 20:39:25 Why does this need reflectToAttribute?
dzhioev (left Google) 2015/06/22 21:17:44 it doesn't. Removed.
15 }, 17 }
18 },
16 19
17 set disabled(value) { 20 onButtonClicked_: function() {
18 var controls = this.querySelectorAll( 21 this.fire('submit');
19 ':host /deep/ [role="button"], :host /deep/ [is="core-input"]'); 22 },
20 for (var i = 0, control; control = controls[i]; ++i) 23
21 control.disabled = value; 24 getInputs_: function() {
22 }, 25 return Polymer.dom(this.$.inputs).getDistributedNodes();
23 }; 26 },
24 })()); 27
28 onKeyDown_: function(e) {
29 if (e.keyCode != 13 || this.$.button.disabled)
30 return;
31 if (this.getInputs_().indexOf(e.target) == -1)
32 return;
33 this.onButtonClicked_();
34 },
35
36 getControls_: function() {
37 var controls = this.getInputs_();
38 controls.push(this.$.button);
39 return controls.concat(Polymer.dom(this).querySelectorAll('gaia-button'));
40 },
41
42 onDisabledChanged_: function(disabled) {
43 this.getControls_().forEach(function(control) {
44 control.disabled = disabled;
45 });
46 }
47 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698