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

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

Issue 2946463002: Convert multi-profile user behavior string to enum and send it to UI. (Closed)
Patch Set: Created 3 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 unified diff | Download patch
« no previous file with comments | « ui/login/account_picker/md_user_pod_row.js ('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 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 * and password placeholder color. 143 * and password placeholder color.
144 * @const {Array<{type: !number, class: !string}>} 144 * @const {Array<{type: !number, class: !string}>}
145 */ 145 */
146 var FINGERPRINT_STATES_MAPPING = [ 146 var FINGERPRINT_STATES_MAPPING = [
147 {state: FINGERPRINT_STATES.HIDDEN, class: 'hidden'}, 147 {state: FINGERPRINT_STATES.HIDDEN, class: 'hidden'},
148 {state: FINGERPRINT_STATES.DEFAULT, class: 'default'}, 148 {state: FINGERPRINT_STATES.DEFAULT, class: 'default'},
149 {state: FINGERPRINT_STATES.SIGNIN, class: 'signin'}, 149 {state: FINGERPRINT_STATES.SIGNIN, class: 'signin'},
150 {state: FINGERPRINT_STATES.FAILED, class: 'failed'} 150 {state: FINGERPRINT_STATES.FAILED, class: 'failed'}
151 ]; 151 ];
152 152
153 // Supported multi-profile user behavior values.
154 // Keep in sync with the enum in multi_profile_user_controller.h
155 var MULTI_PROFILE_USER_BEHAVIOR = {
156 UNRESTRICTED: 0,
157 PRIMARY_ONLY: 1,
158 NOT_ALLOWED: 2,
159 OWNER_PRIMARY_ONLY: 3
160 };
161
153 // Focus and tab order are organized as follows: 162 // Focus and tab order are organized as follows:
154 // 163 //
155 // (1) all user pods have tab index 1 so they are traversed first; 164 // (1) all user pods have tab index 1 so they are traversed first;
156 // (2) when a user pod is activated, its tab index is set to -1 and its 165 // (2) when a user pod is activated, its tab index is set to -1 and its
157 // main input field gets focus and tab index 1; 166 // main input field gets focus and tab index 1;
158 // (3) if user pod custom icon is interactive, it has tab index 2 so it 167 // (3) if user pod custom icon is interactive, it has tab index 2 so it
159 // follows the input. 168 // follows the input.
160 // (4) buttons on the header bar have tab index 3 so they follow the custom 169 // (4) buttons on the header bar have tab index 3 so they follow the custom
161 // icon, or user pod if custom icon is not interactive; 170 // icon, or user pod if custom icon is not interactive;
162 // (5) Action box buttons have tab index 4 and follow header bar buttons; 171 // (5) Action box buttons have tab index 4 and follow header bar buttons;
(...skipping 1040 matching lines...) Expand 10 before | Expand all | Expand 10 after
1203 this.setUserPodIconType('child'); 1212 this.setUserPodIconType('child');
1204 } else if (this.user_.legacySupervisedUser && !this.user_.isDesktopUser) { 1213 } else if (this.user_.legacySupervisedUser && !this.user_.isDesktopUser) {
1205 this.setUserPodIconType('legacySupervised'); 1214 this.setUserPodIconType('legacySupervised');
1206 this.classList.add('legacy-supervised'); 1215 this.classList.add('legacy-supervised');
1207 } else if (this.multiProfilesPolicyApplied) { 1216 } else if (this.multiProfilesPolicyApplied) {
1208 // Mark user pod as not focusable which in addition to the grayed out 1217 // Mark user pod as not focusable which in addition to the grayed out
1209 // filter makes it look in disabled state. 1218 // filter makes it look in disabled state.
1210 this.classList.add('multiprofiles-policy-applied'); 1219 this.classList.add('multiprofiles-policy-applied');
1211 this.setUserPodIconType('policy'); 1220 this.setUserPodIconType('policy');
1212 1221
1213 if (this.user.multiProfilesPolicy == 'primary-only') 1222 if (this.user.multiProfilesPolicy ==
1223 MULTI_PROFILE_USER_BEHAVIOR.PRIMARY_ONLY) {
1214 this.querySelector('.mp-policy-primary-only-msg').hidden = false; 1224 this.querySelector('.mp-policy-primary-only-msg').hidden = false;
1215 else if (this.user.multiProfilesPolicy == 'owner-primary-only') 1225 } else if (this.user.multiProfilesPolicy ==
1226 MULTI_PROFILE_USER_BEHAVIOR.OWNER_PRIMARY_ONLY) {
1216 this.querySelector('.mp-owner-primary-only-msg').hidden = false; 1227 this.querySelector('.mp-owner-primary-only-msg').hidden = false;
1217 else 1228 } else {
1218 this.querySelector('.mp-policy-not-allowed-msg').hidden = false; 1229 this.querySelector('.mp-policy-not-allowed-msg').hidden = false;
1230 }
1219 } else if (this.user_.isApp) { 1231 } else if (this.user_.isApp) {
1220 this.setUserPodIconType('app'); 1232 this.setUserPodIconType('app');
1221 } 1233 }
1222 }, 1234 },
1223 1235
1224 isPinReady: function() { 1236 isPinReady: function() {
1225 return this.pinKeyboard && this.pinKeyboard.offsetHeight > 0; 1237 return this.pinKeyboard && this.pinKeyboard.offsetHeight > 0;
1226 }, 1238 },
1227 1239
1228 set showError(visible) { 1240 set showError(visible) {
(...skipping 2746 matching lines...) Expand 10 before | Expand all | Expand 10 after
3975 if (pod && pod.multiProfilesPolicyApplied) { 3987 if (pod && pod.multiProfilesPolicyApplied) {
3976 pod.userTypeBubbleElement.classList.remove('bubble-shown'); 3988 pod.userTypeBubbleElement.classList.remove('bubble-shown');
3977 } 3989 }
3978 } 3990 }
3979 }; 3991 };
3980 3992
3981 return { 3993 return {
3982 PodRow: PodRow 3994 PodRow: PodRow
3983 }; 3995 };
3984 }); 3996 });
OLDNEW
« no previous file with comments | « ui/login/account_picker/md_user_pod_row.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698