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

Side by Side Diff: chrome/browser/resources/chromeos/quick_unlock/pin_keyboard.js

Issue 2172823002: Submit button does not show up on md-settings anymore. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@lkgr
Patch Set: Rebased. Created 4 years, 4 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 * @fileoverview 6 * @fileoverview
7 * 'pin-keyboard' is a keyboard that can be used to enter PINs or more generally 7 * 'pin-keyboard' is a keyboard that can be used to enter PINs or more generally
8 * numeric values. 8 * numeric values.
9 * 9 *
10 * Properties: 10 * Properties:
(...skipping 21 matching lines...) Expand all
32 properties: { 32 properties: {
33 /** 33 /**
34 * Whether or not the keyboard's input element should be numerical 34 * Whether or not the keyboard's input element should be numerical
35 * or password. 35 * or password.
36 */ 36 */
37 enablePassword: { 37 enablePassword: {
38 type: Boolean, 38 type: Boolean,
39 value: false 39 value: false
40 }, 40 },
41 41
42 /**
43 * Whether or not the keyboard's submit button should be shown.
44 */
45 enableSubmitButton: {
46 type: Boolean,
47 value: false
48 },
49
42 /** The value stored in the keyboard's input element. */ 50 /** The value stored in the keyboard's input element. */
43 value: { 51 value: {
44 type: String, 52 type: String,
45 notify: true, 53 notify: true,
46 value: '', 54 value: '',
47 observer: 'onPinValueChange_' 55 observer: 'onPinValueChange_'
48 } 56 }
49 }, 57 },
50 58
51 /** 59 /**
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 if (event.keyCode == 13) { 122 if (event.keyCode == 13) {
115 this.firePinSubmitEvent_(); 123 this.firePinSubmitEvent_();
116 event.preventDefault(); 124 event.preventDefault();
117 return; 125 return;
118 } 126 }
119 }, 127 },
120 128
121 /** 129 /**
122 * Changes the color of the submit button if PIN is ready. 130 * Changes the color of the submit button if PIN is ready.
123 * @param {string} value 131 * @param {string} value
132 * @private
124 */ 133 */
125 computeSubmitClass_: function(value) { 134 getSubmitClass_: function(value) {
126 return value.length > 0 ? 'ready-background' : ''; 135 return value.length > 0 ? 'ready-background' : '';
127 }, 136 },
128 137
129 /** 138 /**
130 * Computes whether the input type for the pin input should be password or 139 * Computes whether the input type for the pin input should be password or
131 * numerical. 140 * numerical.
141 * @param {boolean} enablePassword
132 * @private 142 * @private
133 */ 143 */
134 computeInputType_: function(enablePassword) { 144 getInputType_: function(enablePassword) {
135 return enablePassword ? 'password' : 'number'; 145 return enablePassword ? 'password' : 'number';
136 }, 146 },
137 147
138 /** 148 /**
139 * Computes the value of the pin input placeholder. 149 * Computes the value of the pin input placeholder.
150 * @param {boolean} enablePassword
140 * @private 151 * @private
141 */ 152 */
142 computeInputPlaceholder_: function(enablePassword) { 153 getInputPlaceholder_: function(enablePassword) {
143 return enablePassword ? this.i18n('pinKeyboardPlaceholderPinPassword') : 154 return enablePassword ? this.i18n('pinKeyboardPlaceholderPinPassword') :
144 this.i18n('pinKeyboardPlaceholderPin'); 155 this.i18n('pinKeyboardPlaceholderPin');
145 }, 156 },
146 157
147 /** 158 /**
148 * Computes the direction of the pin input. 159 * Computes the direction of the pin input.
160 * @param {string} password
149 * @private 161 * @private
150 */ 162 */
151 computeInputClass_: function(password) { 163 getInputClass_: function(password) {
152 // +password will convert a string to a number or to NaN if that's not 164 // +password will convert a string to a number or to NaN if that's not
153 // possible. Number.isInteger will verify the value is not a NaN and that it 165 // possible. Number.isInteger will verify the value is not a NaN and that it
154 // does not contain decimals. 166 // does not contain decimals.
155 // This heuristic will fail for inputs like '1.0'. 167 // This heuristic will fail for inputs like '1.0'.
156 // 168 //
157 // Since we still support users entering their passwords through the PIN 169 // Since we still support users entering their passwords through the PIN
158 // keyboard, we swap the input box to rtl when we think it is a password 170 // keyboard, we swap the input box to rtl when we think it is a password
159 // (just numbers), if the document direction is rtl. 171 // (just numbers), if the document direction is rtl.
160 var enableRtl = (document.dir == 'rtl') && !Number.isInteger(+password); 172 var enableRtl = (document.dir == 'rtl') && !Number.isInteger(+password);
161 return enableRtl ? 'input-non-pin' : ''; 173 return enableRtl ? 'input-non-pin' : '';
174 },
175
176 /**
177 * Computes if the submit button is visible.
178 * @param {boolean} submitEnabled
179 * @private
180 */
181 getSubmitHiddenClass_: function(submitEnabled) {
182 return submitEnabled ? '' : 'submit-button-hidden';
162 } 183 }
163 }); 184 });
OLDNEW
« no previous file with comments | « chrome/browser/resources/chromeos/quick_unlock/pin_keyboard.html ('k') | ui/login/account_picker/user_pod_template.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698