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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/resources/chromeos/login/gaia_input_form.js
diff --git a/chrome/browser/resources/chromeos/login/gaia_input_form.js b/chrome/browser/resources/chromeos/login/gaia_input_form.js
index 811f08b989c7aa1139666a534129548a9d013f9c..5d03c6b6baba49e7abce0dea4796484067a69a9c 100644
--- a/chrome/browser/resources/chromeos/login/gaia_input_form.js
+++ b/chrome/browser/resources/chromeos/login/gaia_input_form.js
@@ -1,24 +1,47 @@
-/* Copyright 2015 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.
- */
-
-Polymer('gaia-input-form', (function() {
- return {
- onButtonClicked: function() {
- this.fire('submit');
- },
+// Copyright 2015 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.
- onKeyDown: function(e) {
- if (e.keyCode == 13 && !this.$.button.disabled)
- this.onButtonClicked();
- },
+Polymer({
+ is: 'gaia-input-form',
- set disabled(value) {
- var controls = this.querySelectorAll(
- ':host /deep/ [role="button"], :host /deep/ [is="core-input"]');
- for (var i = 0, control; control = controls[i]; ++i)
- control.disabled = value;
+ properties: {
+ disabled: {
+ type: Boolean,
+ observer: 'onDisabledChanged_',
},
- };
-})());
+
+ buttonText: {
+ type: String,
+ 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.
+ }
+ },
+
+ onButtonClicked_: function() {
+ this.fire('submit');
+ },
+
+ getInputs_: function() {
+ return Polymer.dom(this.$.inputs).getDistributedNodes();
+ },
+
+ onKeyDown_: function(e) {
+ if (e.keyCode != 13 || this.$.button.disabled)
+ return;
+ if (this.getInputs_().indexOf(e.target) == -1)
+ return;
+ this.onButtonClicked_();
+ },
+
+ getControls_: function() {
+ var controls = this.getInputs_();
+ controls.push(this.$.button);
+ return controls.concat(Polymer.dom(this).querySelectorAll('gaia-button'));
+ },
+
+ onDisabledChanged_: function(disabled) {
+ this.getControls_().forEach(function(control) {
+ control.disabled = disabled;
+ });
+ }
+});

Powered by Google App Engine
This is Rietveld 408576698