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

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

Issue 2254623003: Submit button added to user pod. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@lkgr
Patch Set: 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 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 737 matching lines...) Expand 10 before | Expand all | Expand 10 after
748 }, 748 },
749 749
750 /** 750 /**
751 * Initializes the pod after its properties set and added to a pod row. 751 * Initializes the pod after its properties set and added to a pod row.
752 */ 752 */
753 initialize: function() { 753 initialize: function() {
754 this.passwordElement.addEventListener('keydown', 754 this.passwordElement.addEventListener('keydown',
755 this.parentNode.handleKeyDown.bind(this.parentNode)); 755 this.parentNode.handleKeyDown.bind(this.parentNode));
756 this.passwordElement.addEventListener('keypress', 756 this.passwordElement.addEventListener('keypress',
757 this.handlePasswordKeyPress_.bind(this)); 757 this.handlePasswordKeyPress_.bind(this));
758 this.passwordElement.addEventListener('input',
759 this.handlePasswordInput_.bind(this));
760 this.submitButton.addEventListener('click',
761 this.handleSubmitButtonClick_.bind(this));
758 762
759 this.imageElement.addEventListener('load', 763 this.imageElement.addEventListener('load',
760 this.parentNode.handlePodImageLoad.bind(this.parentNode, this)); 764 this.parentNode.handlePodImageLoad.bind(this.parentNode, this));
761 765
762 var initialAuthType = this.user.initialAuthType || 766 var initialAuthType = this.user.initialAuthType ||
763 AUTH_TYPE.OFFLINE_PASSWORD; 767 AUTH_TYPE.OFFLINE_PASSWORD;
764 this.setAuthType(initialAuthType, null); 768 this.setAuthType(initialAuthType, null);
765 769
766 this.userClickAuthAllowed_ = false; 770 this.userClickAuthAllowed_ = false;
767 }, 771 },
(...skipping 16 matching lines...) Expand all
784 // When tabbing from the system tray a tab key press is received. Suppress 788 // When tabbing from the system tray a tab key press is received. Suppress
785 // this so as not to type a tab character into the password field. 789 // this so as not to type a tab character into the password field.
786 if (e.keyCode == 9) { 790 if (e.keyCode == 9) {
787 e.preventDefault(); 791 e.preventDefault();
788 return; 792 return;
789 } 793 }
790 this.customIconElement.cancelDelayedTooltipShow(); 794 this.customIconElement.cancelDelayedTooltipShow();
791 }, 795 },
792 796
793 /** 797 /**
798 * Handles input changes on password input.
799 * @param {Event} e Input Event object.
800 * @private
801 */
802 handlePasswordInput_: function(e) {
803 this.submitButton.disabled = this.passwordElement.value.length <= 0;
804 this.setErrorDisplay(false);
805 },
806
807 /**
808 * Handles a click event on submit button.
809 * @param {Event} e Click event.
810 */
811 handleSubmitButtonClick_: function(e) {
812 this.parentNode.setActivatedPod(this, e);
813 },
814
815 /**
794 * Top edge margin number of pixels. 816 * Top edge margin number of pixels.
795 * @type {?number} 817 * @type {?number}
796 */ 818 */
797 set top(top) { 819 set top(top) {
798 this.style.top = cr.ui.toCssPx(top); 820 this.style.top = cr.ui.toCssPx(top);
799 }, 821 },
800 822
801 /** 823 /**
802 * Top edge margin number of pixels. 824 * Top edge margin number of pixels.
803 */ 825 */
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
861 883
862 /** 884 /**
863 * Gets password field. 885 * Gets password field.
864 * @type {!HTMLInputElement} 886 * @type {!HTMLInputElement}
865 */ 887 */
866 get passwordElement() { 888 get passwordElement() {
867 return this.querySelector('.password'); 889 return this.querySelector('.password');
868 }, 890 },
869 891
870 /** 892 /**
893 * Gets submit button.
894 * @type {!HTMLInputElement}
895 */
896 get submitButton() {
897 return this.querySelector('.submit-button');
898 },
899
900 /**
871 * Gets the password label, which is used to show a message where the 901 * Gets the password label, which is used to show a message where the
872 * password field is normally. 902 * password field is normally.
873 * @type {!HTMLInputElement} 903 * @type {!HTMLInputElement}
874 */ 904 */
875 get passwordLabelElement() { 905 get passwordLabelElement() {
876 return this.querySelector('.password-label'); 906 return this.querySelector('.password-label');
877 }, 907 },
878 908
879 /** 909 /**
880 * Gets the pin-keyboard of the pod. 910 * Gets the pin-keyboard of the pod.
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
1086 this.querySelector('.mp-policy-primary-only-msg').hidden = false; 1116 this.querySelector('.mp-policy-primary-only-msg').hidden = false;
1087 else if (this.user.multiProfilesPolicy == 'owner-primary-only') 1117 else if (this.user.multiProfilesPolicy == 'owner-primary-only')
1088 this.querySelector('.mp-owner-primary-only-msg').hidden = false; 1118 this.querySelector('.mp-owner-primary-only-msg').hidden = false;
1089 else 1119 else
1090 this.querySelector('.mp-policy-not-allowed-msg').hidden = false; 1120 this.querySelector('.mp-policy-not-allowed-msg').hidden = false;
1091 } else if (this.user_.isApp) { 1121 } else if (this.user_.isApp) {
1092 this.setUserPodIconType('app'); 1122 this.setUserPodIconType('app');
1093 } 1123 }
1094 }, 1124 },
1095 1125
1126 setErrorDisplay: function(visible) {
1127 this.submitButton.classList.toggle('error-shown', visible);
1128 },
1129
1096 toggleTransitions: function(enable) { 1130 toggleTransitions: function(enable) {
1097 this.classList.toggle('flying-pin-pod', enable); 1131 this.classList.toggle('flying-pin-pod', enable);
1098 }, 1132 },
1099 1133
1100 updatePinClass_: function(element, enable) { 1134 updatePinClass_: function(element, enable) {
1101 element.classList.toggle('pin-enabled', enable); 1135 element.classList.toggle('pin-enabled', enable);
1102 element.classList.toggle('pin-disabled', !enable); 1136 element.classList.toggle('pin-disabled', !enable);
1103 }, 1137 },
1104 1138
1105 setPinVisibility: function(visible) { 1139 setPinVisibility: function(visible) {
(...skipping 1429 matching lines...) Expand 10 before | Expand all | Expand 10 after
2535 /** 2569 /**
2536 * Add an existing user pod to this pod row. 2570 * Add an existing user pod to this pod row.
2537 * @param {!Object} user User info dictionary. 2571 * @param {!Object} user User info dictionary.
2538 */ 2572 */
2539 addUserPod: function(user) { 2573 addUserPod: function(user) {
2540 var userPod = this.createUserPod(user); 2574 var userPod = this.createUserPod(user);
2541 this.appendChild(userPod); 2575 this.appendChild(userPod);
2542 userPod.initialize(); 2576 userPod.initialize();
2543 }, 2577 },
2544 2578
2579 /**
2580 * Performs visual changes on the user pod if there is an error.
2581 * @param {boolean} visible Whether to show or hide the display.
2582 */
2583 setFocusedPodErrorDisplay: function(visible) {
2584 if (this.focusedPod_)
2585 this.focusedPod_.setErrorDisplay(visible);
2586 },
2587
2588 /**
2589 * Enables or disables transitions on the user pod.
2590 * @param {boolean} enable
2591 */
2545 togglePinTransitions: function(enable) { 2592 togglePinTransitions: function(enable) {
2546 for (var i = 0; i < this.pods.length; ++i) 2593 for (var i = 0; i < this.pods.length; ++i)
2547 this.pods[i].toggleTransitions(enable); 2594 this.pods[i].toggleTransitions(enable);
2548 }, 2595 },
2549 2596
2597 /**
2598 * Shows or hides the pin keyboard.
2599 * @param {boolean} visible
2600 */
2550 setFocusedPodPinVisibility: function(visible) { 2601 setFocusedPodPinVisibility: function(visible) {
2551 if (this.focusedPod_ && this.focusedPod_.user.showPin) 2602 if (this.focusedPod_ && this.focusedPod_.user.showPin)
2552 this.focusedPod_.setPinVisibility(visible); 2603 this.focusedPod_.setPinVisibility(visible);
2553 }, 2604 },
2554 2605
2555 /** 2606 /**
2556 * Runs app with a given id from the list of loaded apps. 2607 * Runs app with a given id from the list of loaded apps.
2557 * @param {!string} app_id of an app to run. 2608 * @param {!string} app_id of an app to run.
2558 * @param {boolean=} opt_diagnosticMode Whether to run the app in 2609 * @param {boolean=} opt_diagnosticMode Whether to run the app in
2559 * diagnostic mode. Default is false. 2610 * diagnostic mode. Default is false.
(...skipping 964 matching lines...) Expand 10 before | Expand all | Expand 10 after
3524 if (pod && pod.multiProfilesPolicyApplied) { 3575 if (pod && pod.multiProfilesPolicyApplied) {
3525 pod.userTypeBubbleElement.classList.remove('bubble-shown'); 3576 pod.userTypeBubbleElement.classList.remove('bubble-shown');
3526 } 3577 }
3527 } 3578 }
3528 }; 3579 };
3529 3580
3530 return { 3581 return {
3531 PodRow: PodRow 3582 PodRow: PodRow
3532 }; 3583 };
3533 }); 3584 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698