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

Side by Side Diff: ui/login/account_picker/user_pod_row.js

Issue 2302483003: Pin keyboard improvements. (Closed)
Patch Set: Remove async. Created 4 years, 3 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
« no previous file with comments | « chrome/browser/ui/webui/settings/md_settings_localized_strings_provider.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 User pod row implementation. 6 * @fileoverview User pod row implementation.
7 */ 7 */
8 8
9 cr.define('login', function() { 9 cr.define('login', function() {
10 /** 10 /**
(...skipping 696 matching lines...) Expand 10 before | Expand all | Expand 10 after
707 /** @override */ 707 /** @override */
708 decorate: function() { 708 decorate: function() {
709 this.tabIndex = UserPodTabOrder.POD_INPUT; 709 this.tabIndex = UserPodTabOrder.POD_INPUT;
710 this.actionBoxAreaElement.tabIndex = UserPodTabOrder.POD_INPUT; 710 this.actionBoxAreaElement.tabIndex = UserPodTabOrder.POD_INPUT;
711 711
712 this.addEventListener('keydown', this.handlePodKeyDown_.bind(this)); 712 this.addEventListener('keydown', this.handlePodKeyDown_.bind(this));
713 this.addEventListener('click', this.handleClickOnPod_.bind(this)); 713 this.addEventListener('click', this.handleClickOnPod_.bind(this));
714 this.addEventListener('mousedown', this.handlePodMouseDown_.bind(this)); 714 this.addEventListener('mousedown', this.handlePodMouseDown_.bind(this));
715 715
716 if (this.pinKeyboard) { 716 if (this.pinKeyboard) {
717 this.pinKeyboard.addEventListener('submit',
718 this.handlePinSubmitted_.bind(this));
719 this.pinKeyboard.addEventListener('pin-change', 717 this.pinKeyboard.addEventListener('pin-change',
720 this.handlePinChanged_.bind(this)); 718 this.handlePinChanged_.bind(this));
721 } 719 }
722 720
723 this.actionBoxAreaElement.addEventListener('mousedown', 721 this.actionBoxAreaElement.addEventListener('mousedown',
724 stopEventPropagation); 722 stopEventPropagation);
725 this.actionBoxAreaElement.addEventListener('click', 723 this.actionBoxAreaElement.addEventListener('click',
726 this.handleActionAreaButtonClick_.bind(this)); 724 this.handleActionAreaButtonClick_.bind(this));
727 this.actionBoxAreaElement.addEventListener('keydown', 725 this.actionBoxAreaElement.addEventListener('keydown',
728 this.handleActionAreaButtonKeyDown_.bind(this)); 726 this.handleActionAreaButtonKeyDown_.bind(this));
(...skipping 21 matching lines...) Expand all
750 /** 748 /**
751 * Initializes the pod after its properties set and added to a pod row. 749 * Initializes the pod after its properties set and added to a pod row.
752 */ 750 */
753 initialize: function() { 751 initialize: function() {
754 this.passwordElement.addEventListener('keydown', 752 this.passwordElement.addEventListener('keydown',
755 this.parentNode.handleKeyDown.bind(this.parentNode)); 753 this.parentNode.handleKeyDown.bind(this.parentNode));
756 this.passwordElement.addEventListener('keypress', 754 this.passwordElement.addEventListener('keypress',
757 this.handlePasswordKeyPress_.bind(this)); 755 this.handlePasswordKeyPress_.bind(this));
758 this.passwordElement.addEventListener('input', 756 this.passwordElement.addEventListener('input',
759 this.handleInputChanged_.bind(this)); 757 this.handleInputChanged_.bind(this));
758
760 this.submitButton.addEventListener('click', 759 this.submitButton.addEventListener('click',
761 this.handleSubmitButtonClick_.bind(this)); 760 this.handleSubmitButtonClick_.bind(this));
762 761
763 this.imageElement.addEventListener('load', 762 this.imageElement.addEventListener('load',
764 this.parentNode.handlePodImageLoad.bind(this.parentNode, this)); 763 this.parentNode.handlePodImageLoad.bind(this.parentNode, this));
765 764
766 var initialAuthType = this.user.initialAuthType || 765 var initialAuthType = this.user.initialAuthType ||
767 AUTH_TYPE.OFFLINE_PASSWORD; 766 AUTH_TYPE.OFFLINE_PASSWORD;
768 this.setAuthType(initialAuthType, null); 767 this.setAuthType(initialAuthType, null);
769 768
(...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after
1152 if (visible && Oobe.getInstance().virtualKeyboardShown) 1151 if (visible && Oobe.getInstance().virtualKeyboardShown)
1153 return; 1152 return;
1154 1153
1155 var elements = this.getElementsByClassName('pin-tag'); 1154 var elements = this.getElementsByClassName('pin-tag');
1156 for (var i = 0; i < elements.length; ++i) 1155 for (var i = 0; i < elements.length; ++i)
1157 this.updatePinClass_(elements[i], visible); 1156 this.updatePinClass_(elements[i], visible);
1158 this.updatePinClass_(this, visible); 1157 this.updatePinClass_(this, visible);
1159 1158
1160 // Set the focus to the input element after showing/hiding pin keyboard. 1159 // Set the focus to the input element after showing/hiding pin keyboard.
1161 this.mainInput.focus(); 1160 this.mainInput.focus();
1161
1162 // Change the password placeholder based on pin keyboard visibility.
1163 this.passwordElement.placeholder = loadTimeData.getString(visible ?
1164 'pinKeyboardPlaceholderPinPassword' : 'passwordHint');
1162 }, 1165 },
1163 1166
1164 isPinShown: function() { 1167 isPinShown: function() {
1165 return this.classList.contains('pin-enabled'); 1168 return this.classList.contains('pin-enabled');
1166 }, 1169 },
1167 1170
1168 setUserPodIconType: function(userTypeClass) { 1171 setUserPodIconType: function(userTypeClass) {
1169 this.userTypeIconAreaElement.classList.add(userTypeClass); 1172 this.userTypeIconAreaElement.classList.add(userTypeClass);
1170 this.userTypeIconAreaElement.hidden = false; 1173 this.userTypeIconAreaElement.hidden = false;
1171 }, 1174 },
(...skipping 668 matching lines...) Expand 10 before | Expand all | Expand 10 after
1840 * Handles mouse down event. It sets whether the user click auth will be 1843 * Handles mouse down event. It sets whether the user click auth will be
1841 * allowed on the next mouse click event. The auth is allowed iff the pod 1844 * allowed on the next mouse click event. The auth is allowed iff the pod
1842 * was focused on the mouse down event starting the click. 1845 * was focused on the mouse down event starting the click.
1843 * @param {Event} e The mouse down event. 1846 * @param {Event} e The mouse down event.
1844 */ 1847 */
1845 handlePodMouseDown_: function(e) { 1848 handlePodMouseDown_: function(e) {
1846 this.userClickAuthAllowed_ = this.parentNode.isFocused(this); 1849 this.userClickAuthAllowed_ = this.parentNode.isFocused(this);
1847 }, 1850 },
1848 1851
1849 /** 1852 /**
1850 * Handles click event on submit button on the pin keyboard. 1853 * Called when the input of the password element changes. Updates the submit
1851 * @param {Event} e Click event. 1854 * button color and state and hides the error popup bubble.
1852 */ 1855 */
1853 handlePinSubmitted_: function(e) { 1856 updateInput_: function() {
1854 if (this.parentNode.isFocused(this)) 1857 this.submitButton.disabled = this.passwordElement.value.length <= 0;
1855 this.parentNode.setActivatedPod(this); 1858 this.showError = false;
1859 $('bubble').hide();
1856 }, 1860 },
1857 1861
1862 /**
1863 * Handles pin change event from the pin keyboard.
1864 * @param {Event} e Pin change event.
1865 */
1858 handlePinChanged_: function(e) { 1866 handlePinChanged_: function(e) {
1859 this.passwordElement.value = e.detail.pin; 1867 this.passwordElement.value = e.detail.pin;
1868 this.updateInput_();
1860 }, 1869 },
1861 1870
1871 /**
1872 * Handles input event on the password element.
1873 * @param {Event} e Input event.
1874 */
1862 handleInputChanged_: function(e) { 1875 handleInputChanged_: function(e) {
1863 if (this.pinKeyboard) 1876 if (this.pinKeyboard)
1864 this.pinKeyboard.value = this.passwordElement.value; 1877 this.pinKeyboard.value = this.passwordElement.value;
1865 this.submitButton.disabled = this.passwordElement.value.length <= 0; 1878 this.updateInput_();
1866 this.showError = false;
1867 }, 1879 },
1868 1880
1869 /** 1881 /**
1870 * Handles click event on a user pod. 1882 * Handles click event on a user pod.
1871 * @param {Event} e Click event. 1883 * @param {Event} e Click event.
1872 */ 1884 */
1873 handleClickOnPod_: function(e) { 1885 handleClickOnPod_: function(e) {
1874 if (this.parentNode.disabled) 1886 if (this.parentNode.disabled)
1875 return; 1887 return;
1876 1888
(...skipping 1755 matching lines...) Expand 10 before | Expand all | Expand 10 after
3632 if (pod && pod.multiProfilesPolicyApplied) { 3644 if (pod && pod.multiProfilesPolicyApplied) {
3633 pod.userTypeBubbleElement.classList.remove('bubble-shown'); 3645 pod.userTypeBubbleElement.classList.remove('bubble-shown');
3634 } 3646 }
3635 } 3647 }
3636 }; 3648 };
3637 3649
3638 return { 3650 return {
3639 PodRow: PodRow 3651 PodRow: PodRow
3640 }; 3652 };
3641 }); 3653 });
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/settings/md_settings_localized_strings_provider.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698