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

Side by Side Diff: ui/login/account_picker/md_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
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 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 * and password placeholder color. 120 * and password placeholder color.
121 * @const {Array<{type: !number, class: !string}>} 121 * @const {Array<{type: !number, class: !string}>}
122 */ 122 */
123 var FINGERPRINT_STATES_MAPPING = [ 123 var FINGERPRINT_STATES_MAPPING = [
124 {state: FINGERPRINT_STATES.HIDDEN, class: 'hidden'}, 124 {state: FINGERPRINT_STATES.HIDDEN, class: 'hidden'},
125 {state: FINGERPRINT_STATES.DEFAULT, class: 'default'}, 125 {state: FINGERPRINT_STATES.DEFAULT, class: 'default'},
126 {state: FINGERPRINT_STATES.SIGNIN, class: 'signin'}, 126 {state: FINGERPRINT_STATES.SIGNIN, class: 'signin'},
127 {state: FINGERPRINT_STATES.FAILED, class: 'failed'} 127 {state: FINGERPRINT_STATES.FAILED, class: 'failed'}
128 ]; 128 ];
129 129
130 // Supported multi-profile user behavior values.
131 // Keep in sync with the enum in multi_profile_user_controller.h
132 var MULTI_PROFILE_USER_BEHAVIOR = {
133 UNRESTRICTED: 0,
134 PRIMARY_ONLY: 1,
135 NOT_ALLOWED: 2,
136 OWNER_PRIMARY_ONLY: 3
137 };
138
130 // Focus and tab order are organized as follows: 139 // Focus and tab order are organized as follows:
131 // 140 //
132 // (1) all user pods have tab index 1 so they are traversed first; 141 // (1) all user pods have tab index 1 so they are traversed first;
133 // (2) when a user pod is activated, its tab index is set to -1 and its 142 // (2) when a user pod is activated, its tab index is set to -1 and its
134 // main input field gets focus and tab index 1; 143 // main input field gets focus and tab index 1;
135 // (3) if pin keyboard is present, it has tab index 2 so it follows the input; 144 // (3) if pin keyboard is present, it has tab index 2 so it follows the input;
136 // (4) if user pod custom icon is interactive, it has tab index 3; 145 // (4) if user pod custom icon is interactive, it has tab index 3;
137 // (5) buttons on the header bar have tab index 4; 146 // (5) buttons on the header bar have tab index 4;
138 // (6) Action box buttons have tab index 5 and follow the buttons on the 147 // (6) Action box buttons have tab index 5 and follow the buttons on the
139 // header bar; 148 // header bar;
(...skipping 1122 matching lines...) Expand 10 before | Expand all | Expand 10 after
1262 this.setUserPodIconType('child'); 1271 this.setUserPodIconType('child');
1263 } else if (this.user_.legacySupervisedUser && !this.user_.isDesktopUser) { 1272 } else if (this.user_.legacySupervisedUser && !this.user_.isDesktopUser) {
1264 this.setUserPodIconType('legacySupervised'); 1273 this.setUserPodIconType('legacySupervised');
1265 this.classList.add('legacy-supervised'); 1274 this.classList.add('legacy-supervised');
1266 } else if (this.multiProfilesPolicyApplied) { 1275 } else if (this.multiProfilesPolicyApplied) {
1267 // Mark user pod as not focusable which in addition to the grayed out 1276 // Mark user pod as not focusable which in addition to the grayed out
1268 // filter makes it look in disabled state. 1277 // filter makes it look in disabled state.
1269 this.classList.add('multiprofiles-policy-applied'); 1278 this.classList.add('multiprofiles-policy-applied');
1270 this.setUserPodIconType('policy'); 1279 this.setUserPodIconType('policy');
1271 1280
1272 if (this.user.multiProfilesPolicy == 'primary-only') 1281 if (this.user.multiProfilesPolicy ==
1282 MULTI_PROFILE_USER_BEHAVIOR.PRIMARY_ONLY) {
1273 this.querySelector('.mp-policy-primary-only-msg').hidden = false; 1283 this.querySelector('.mp-policy-primary-only-msg').hidden = false;
1274 else if (this.user.multiProfilesPolicy == 'owner-primary-only') 1284 } else if (this.user.multiProfilesPolicy ==
1285 MULTI_PROFILE_USER_BEHAVIOR.OWNER_PRIMARY_ONLY) {
1275 this.querySelector('.mp-owner-primary-only-msg').hidden = false; 1286 this.querySelector('.mp-owner-primary-only-msg').hidden = false;
1276 else 1287 } else {
1277 this.querySelector('.mp-policy-not-allowed-msg').hidden = false; 1288 this.querySelector('.mp-policy-not-allowed-msg').hidden = false;
1289 }
1278 } else if (this.user_.isApp) { 1290 } else if (this.user_.isApp) {
1279 this.setUserPodIconType('app'); 1291 this.setUserPodIconType('app');
1280 } 1292 }
1281 }, 1293 },
1282 1294
1283 isPinReady: function() { 1295 isPinReady: function() {
1284 return this.pinKeyboard && this.pinKeyboard.offsetHeight > 0; 1296 return this.pinKeyboard && this.pinKeyboard.offsetHeight > 0;
1285 }, 1297 },
1286 1298
1287 set showError(visible) { 1299 set showError(visible) {
(...skipping 3302 matching lines...) Expand 10 before | Expand all | Expand 10 after
4590 if (pod && pod.multiProfilesPolicyApplied) { 4602 if (pod && pod.multiProfilesPolicyApplied) {
4591 pod.userTypeBubbleElement.classList.remove('bubble-shown'); 4603 pod.userTypeBubbleElement.classList.remove('bubble-shown');
4592 } 4604 }
4593 } 4605 }
4594 }; 4606 };
4595 4607
4596 return { 4608 return {
4597 PodRow: PodRow 4609 PodRow: PodRow
4598 }; 4610 };
4599 }); 4611 });
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/users/multi_profile_user_controller.cc ('k') | ui/login/account_picker/user_pod_row.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698