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

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

Issue 2841313002: md settings: Update lock screen to match new mocks. (Closed)
Patch Set: Created 3 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 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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 ], 55 ],
56 56
57 properties: { 57 properties: {
58 /** 58 /**
59 * Whether or not the keyboard's input element should be numerical 59 * Whether or not the keyboard's input element should be numerical
60 * or password. 60 * or password.
61 * @private 61 * @private
62 */ 62 */
63 enablePassword: { 63 enablePassword: {
64 type: Boolean, 64 type: Boolean,
65 value: false 65 value: false,
66 }, 66 },
67 67
68 /** 68 /**
69 * The password element the pin keyboard is associated with. If this is not 69 * The password element the pin keyboard is associated with. If this is not
70 * set, then a default input element is shown and used. 70 * set, then a default input element is shown and used.
71 * @type {?Element} 71 * @type {?Element}
72 * @private 72 * @private
73 */ 73 */
74 passwordElement: { 74 passwordElement: {
75 type: Object, 75 type: Object,
76 value: function() { return this.$$('#pin-input'); }, 76 value: function() {
77 observer: 'onPasswordElementAttached_' 77 return this.$.pinInput.inputElement;
78 },
79 observer: 'onPasswordElementAttached_',
78 }, 80 },
79 81
80 /** 82 /**
81 * The value stored in the keyboard's input element. 83 * The value stored in the keyboard's input element.
82 * @private 84 * @private
83 */ 85 */
84 value: { 86 value: {
85 type: String, 87 type: String,
86 notify: true, 88 notify: true,
87 value: '', 89 value: '',
88 observer: 'onPinValueChange_' 90 observer: 'onPinValueChange_',
89 }, 91 },
90 92
91 /** 93 /**
92 * The intervalID used for the backspace button set/clear interval. 94 * The intervalID used for the backspace button set/clear interval.
93 * @private 95 * @private
94 */ 96 */
95 repeatBackspaceIntervalId_: { 97 repeatBackspaceIntervalId_: {
96 type: Number, 98 type: Number,
97 value: 0 99 value: 0,
jdufault 2017/04/27 18:47:17 Are these commas all automatically inserted by too
sammiequon 2017/04/27 19:26:44 The formatting will squash them on onto one line i
98 }, 100 },
99 101
100 /** 102 /**
101 * The timeoutID used for the auto backspace. 103 * The timeoutID used for the auto backspace.
102 * @private 104 * @private
103 */ 105 */
104 startAutoBackspaceId_: { 106 startAutoBackspaceId_: {
105 type: Number, 107 type: Number,
106 value: 0 108 value: 0,
107 } 109 }
108 }, 110 },
109 111
110 /** 112 /**
111 * Called when a password element is attached to the pin keyboard. 113 * Called when a password element is attached to the pin keyboard.
112 * @param {HTMLInputElement} inputElement The PIN keyboard's input element. 114 * @param {HTMLInputElement} inputElement The PIN keyboard's input element.
113 * @private 115 * @private
114 */ 116 */
115 onPasswordElementAttached_: function(inputElement) { 117 onPasswordElementAttached_: function(inputElement) {
116 if (inputElement != this.$$('#pin-input')) 118 if (inputElement != this.$.pinInput.inputElement)
117 this.$$('#pin-input').hidden = true; 119 this.$.pinInput.hidden = true;
120 else
121 this.$$('hr').hidden = true;
jdufault 2017/04/27 18:47:17 Provide an id/class?
sammiequon 2017/04/27 19:26:44 Done.
122
118 inputElement.addEventListener('input', 123 inputElement.addEventListener('input',
119 this.handleInputChanged_.bind(this)); 124 this.handleInputChanged_.bind(this));
120 }, 125 },
121 126
122 /** 127 /**
123 * Called when the user uses the keyboard to enter a value into the input 128 * Called when the user uses the keyboard to enter a value into the input
124 * element. 129 * element.
125 * @param {Event} event The event object. 130 * @param {Event} event The event object.
126 * @private 131 * @private
127 */ 132 */
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
381 // does not contain decimals. 386 // does not contain decimals.
382 // This heuristic will fail for inputs like '1.0'. 387 // This heuristic will fail for inputs like '1.0'.
383 // 388 //
384 // Since we still support users entering their passwords through the PIN 389 // Since we still support users entering their passwords through the PIN
385 // keyboard, we swap the input box to rtl when we think it is a password 390 // keyboard, we swap the input box to rtl when we think it is a password
386 // (just numbers), if the document direction is rtl. 391 // (just numbers), if the document direction is rtl.
387 return (document.dir == 'rtl') && !Number.isInteger(+password); 392 return (document.dir == 'rtl') && !Number.isInteger(+password);
388 }, 393 },
389 }); 394 });
390 })(); 395 })();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698