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

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

Issue 2222583002: Lock screen pin keyboard ui upgrades. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@lkgr
Patch Set: Fix for closure. 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
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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 var DESKTOP_POD_WIDTH = 180; 52 var DESKTOP_POD_WIDTH = 180;
53 var MD_DESKTOP_POD_WIDTH = 160; 53 var MD_DESKTOP_POD_WIDTH = 160;
54 var PUBLIC_EXPANDED_BASIC_WIDTH = 500; 54 var PUBLIC_EXPANDED_BASIC_WIDTH = 500;
55 var PUBLIC_EXPANDED_ADVANCED_WIDTH = 610; 55 var PUBLIC_EXPANDED_ADVANCED_WIDTH = 610;
56 var CROS_POD_HEIGHT = 213; 56 var CROS_POD_HEIGHT = 213;
57 var DESKTOP_POD_HEIGHT = 226; 57 var DESKTOP_POD_HEIGHT = 226;
58 var MD_DESKTOP_POD_HEIGHT = 200; 58 var MD_DESKTOP_POD_HEIGHT = 200;
59 var POD_ROW_PADDING = 10; 59 var POD_ROW_PADDING = 10;
60 var DESKTOP_ROW_PADDING = 32; 60 var DESKTOP_ROW_PADDING = 32;
61 var CUSTOM_ICON_CONTAINER_SIZE = 40; 61 var CUSTOM_ICON_CONTAINER_SIZE = 40;
62 var CROS_PIN_POD_WIDTH = 270; 62 var CROS_PIN_POD_HEIGHT = 417;
63 var CROS_PIN_POD_HEIGHT = 594;
64 var PIN_EXTRA_WIDTH = 90;
65 63
66 /** 64 /**
67 * Minimal padding between user pod and virtual keyboard. 65 * Minimal padding between user pod and virtual keyboard.
68 * @type {number} 66 * @type {number}
69 * @const 67 * @const
70 */ 68 */
71 var USER_POD_KEYBOARD_MIN_PADDING = 20; 69 var USER_POD_KEYBOARD_MIN_PADDING = 20;
72 70
73 /** 71 /**
74 * Maximum time for which the pod row remains hidden until all user images 72 * Maximum time for which the pod row remains hidden until all user images
(...skipping 1011 matching lines...) Expand 10 before | Expand all | Expand 10 after
1086 this.querySelector('.mp-policy-primary-only-msg').hidden = false; 1084 this.querySelector('.mp-policy-primary-only-msg').hidden = false;
1087 else if (this.user.multiProfilesPolicy == 'owner-primary-only') 1085 else if (this.user.multiProfilesPolicy == 'owner-primary-only')
1088 this.querySelector('.mp-owner-primary-only-msg').hidden = false; 1086 this.querySelector('.mp-owner-primary-only-msg').hidden = false;
1089 else 1087 else
1090 this.querySelector('.mp-policy-not-allowed-msg').hidden = false; 1088 this.querySelector('.mp-policy-not-allowed-msg').hidden = false;
1091 } else if (this.user_.isApp) { 1089 } else if (this.user_.isApp) {
1092 this.setUserPodIconType('app'); 1090 this.setUserPodIconType('app');
1093 } 1091 }
1094 }, 1092 },
1095 1093
1094 isPinReady: function() {
1095 return this.pinKeyboard && this.pinKeyboard.offsetHeight > 0;
1096 },
1097
1096 toggleTransitions: function(enable) { 1098 toggleTransitions: function(enable) {
1097 this.classList.toggle('flying-pin-pod', enable); 1099 this.classList.toggle('flying-pin-pod', enable);
1098 }, 1100 },
1099 1101
1100 updatePinClass_: function(element, enable) { 1102 updatePinClass_: function(element, enable) {
1101 element.classList.toggle('pin-enabled', enable); 1103 element.classList.toggle('pin-enabled', enable);
1102 element.classList.toggle('pin-disabled', !enable); 1104 element.classList.toggle('pin-disabled', !enable);
1103 }, 1105 },
1104 1106
1105 setPinVisibility: function(visible) { 1107 setPinVisibility: function(visible) {
(...skipping 1889 matching lines...) Expand 10 before | Expand all | Expand 10 after
2995 // One more iteration if it's not enough cells to place all pods. 2997 // One more iteration if it's not enough cells to place all pods.
2996 while (maxWidth >= this.columnsToWidth_(columns + 1) && 2998 while (maxWidth >= this.columnsToWidth_(columns + 1) &&
2997 columns * rows < this.pods.length && 2999 columns * rows < this.pods.length &&
2998 columns < MAX_NUMBER_OF_COLUMNS) { 3000 columns < MAX_NUMBER_OF_COLUMNS) {
2999 ++columns; 3001 ++columns;
3000 } 3002 }
3001 return {columns: columns, rows: rows}; 3003 return {columns: columns, rows: rows};
3002 }, 3004 },
3003 3005
3004 /** 3006 /**
3005 * Calculates the row and column of the given |pod|.
3006 * @param {UserPod} pod Pod we want the row and column of.
3007 * @param {number} columns Columns in the podrow.
3008 * @param {number} rows Rows in the podrow.
3009 * @return {{columns: number, rows: number}}
3010 * @private
3011 */
3012 findPodLocation_: function(pod, columns, rows) {
3013 var column = -1;
3014 var row = -1;
3015 var index = this.pods.indexOf(pod);
3016 if (index >= 0) {
3017 row = Math.floor(index / columns);
3018 column = index % columns;
3019 }
3020 else {
3021 console.error('Pod not found in pod row.');
3022 }
3023 return {column: column, row: row};
3024 },
3025
3026 /**
3027 * Places pods onto their positions onto pod grid. 3007 * Places pods onto their positions onto pod grid.
3028 * @private 3008 * @private
3029 */ 3009 */
3030 placePods_: function() { 3010 placePods_: function() {
3031 var isDesktopUserManager = Oobe.getInstance().displayType == 3011 var isDesktopUserManager = Oobe.getInstance().displayType ==
3032 DISPLAY_TYPE.DESKTOP_USER_MANAGER; 3012 DISPLAY_TYPE.DESKTOP_USER_MANAGER;
3033 if (isDesktopUserManager && !Oobe.getInstance().userPodsPageVisible) 3013 if (isDesktopUserManager && !Oobe.getInstance().userPodsPageVisible)
3034 return; 3014 return;
3035 3015
3036 var layout = this.calculateLayout_(); 3016 var layout = this.calculateLayout_();
(...skipping 14 matching lines...) Expand all
3051 if (index >= maxPodsNumber) { 3031 if (index >= maxPodsNumber) {
3052 pod.hidden = true; 3032 pod.hidden = true;
3053 return; 3033 return;
3054 } 3034 }
3055 pod.hidden = false; 3035 pod.hidden = false;
3056 if (pod.offsetHeight != height && 3036 if (pod.offsetHeight != height &&
3057 pod.offsetHeight != CROS_PIN_POD_HEIGHT) { 3037 pod.offsetHeight != CROS_PIN_POD_HEIGHT) {
3058 console.error('Pod offsetHeight (' + pod.offsetHeight + 3038 console.error('Pod offsetHeight (' + pod.offsetHeight +
3059 ') and POD_HEIGHT (' + height + ') are not equal.'); 3039 ') and POD_HEIGHT (' + height + ') are not equal.');
3060 } 3040 }
3061 if (pod.offsetWidth != width && 3041 if (pod.offsetWidth != width) {
3062 pod.offsetWidth != CROS_PIN_POD_WIDTH) {
3063 console.error('Pod offsetWidth (' + pod.offsetWidth + 3042 console.error('Pod offsetWidth (' + pod.offsetWidth +
3064 ') and POD_WIDTH (' + width + ') are not equal.'); 3043 ') and POD_WIDTH (' + width + ') are not equal.');
3065 } 3044 }
3066 var column = index % columns; 3045 var column = index % columns;
3067 var row = Math.floor(index / columns); 3046 var row = Math.floor(index / columns);
3068 var offsetFromPin = 0;
3069 if (row == pinPodLocation.row) {
3070 offsetFromPin = PIN_EXTRA_WIDTH / 2;
3071 if (column <= pinPodLocation.column)
3072 offsetFromPin *= -1;
3073 }
3074 3047
3075 var rowPadding = isDesktopUserManager ? DESKTOP_ROW_PADDING : 3048 var rowPadding = isDesktopUserManager ? DESKTOP_ROW_PADDING :
3076 POD_ROW_PADDING; 3049 POD_ROW_PADDING;
3077 pod.left = rowPadding + column * (width + margin) + offsetFromPin; 3050 pod.left = rowPadding + column * (width + margin);
3078 3051
3079 // On desktop, we want the rows to always be equally spaced. 3052 // On desktop, we want the rows to always be equally spaced.
3080 pod.top = isDesktopUserManager ? row * (height + rowPadding) : 3053 pod.top = isDesktopUserManager ? row * (height + rowPadding) :
3081 row * height + rowPadding; 3054 row * height + rowPadding;
3082 }); 3055 });
3083 Oobe.getInstance().updateScreenSize(this.parentNode); 3056 Oobe.getInstance().updateScreenSize(this.parentNode);
3084 }, 3057 },
3085 3058
3086 /** 3059 /**
3087 * Number of columns. 3060 * Number of columns.
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
3156 } 3129 }
3157 } 3130 }
3158 3131
3159 // Clear any error messages for previous pod. 3132 // Clear any error messages for previous pod.
3160 if (!this.isFocused(podToFocus)) 3133 if (!this.isFocused(podToFocus))
3161 Oobe.clearErrors(); 3134 Oobe.clearErrors();
3162 3135
3163 var hadFocus = !!this.focusedPod_; 3136 var hadFocus = !!this.focusedPod_;
3164 this.focusedPod_ = podToFocus; 3137 this.focusedPod_ = podToFocus;
3165 if (podToFocus) { 3138 if (podToFocus) {
3166 this.setFocusedPodPinVisibility(true); 3139 // Only show the keyboard if it is fully loaded.
3140 if (podToFocus.isPinReady())
3141 podToFocus.setPinVisibility(true);
3167 podToFocus.classList.remove('faded'); 3142 podToFocus.classList.remove('faded');
3168 podToFocus.classList.add('focused'); 3143 podToFocus.classList.add('focused');
3169 if (!podToFocus.multiProfilesPolicyApplied) { 3144 if (!podToFocus.multiProfilesPolicyApplied) {
3170 podToFocus.classList.toggle('signing-in', false); 3145 podToFocus.classList.toggle('signing-in', false);
3171 if (!opt_skipInputFocus) 3146 if (!opt_skipInputFocus)
3172 podToFocus.focusInput(); 3147 podToFocus.focusInput();
3173 } else { 3148 } else {
3174 podToFocus.userTypeBubbleElement.classList.add('bubble-shown'); 3149 podToFocus.userTypeBubbleElement.classList.add('bubble-shown');
3175 // Note it is not necessary to skip this focus request when 3150 // Note it is not necessary to skip this focus request when
3176 // |opt_skipInputFocus| is true. When |multiProfilesPolicyApplied| 3151 // |opt_skipInputFocus| is true. When |multiProfilesPolicyApplied|
3177 // is false, it doesn't focus on the password input box by default. 3152 // is false, it doesn't focus on the password input box by default.
3178 podToFocus.focus(); 3153 podToFocus.focus();
3179 } 3154 }
3180 3155
3181 // focusPod() automatically loads wallpaper 3156 // focusPod() automatically loads wallpaper
3182 if (!podToFocus.user.isApp) 3157 if (!podToFocus.user.isApp)
3183 chrome.send('focusPod', [podToFocus.user.username]); 3158 chrome.send('focusPod', [podToFocus.user.username]);
3184 this.firstShown_ = false; 3159 this.firstShown_ = false;
3185 this.lastFocusedPod_ = podToFocus; 3160 this.lastFocusedPod_ = podToFocus;
3186 this.scrollFocusedPodIntoView(); 3161 this.scrollFocusedPodIntoView();
3187 } 3162 }
3188 this.insideFocusPod_ = false; 3163 this.insideFocusPod_ = false;
3189 this.placePods_();
3190 }, 3164 },
3191 3165
3192 /** 3166 /**
3193 * Resets wallpaper to the last active user's wallpaper, if any. 3167 * Resets wallpaper to the last active user's wallpaper, if any.
3194 */ 3168 */
3195 loadLastWallpaper: function() { 3169 loadLastWallpaper: function() {
3196 if (this.lastFocusedPod_ && !this.lastFocusedPod_.user.isApp) 3170 if (this.lastFocusedPod_ && !this.lastFocusedPod_.user.isApp)
3197 chrome.send('loadWallpaper', [this.lastFocusedPod_.user.username]); 3171 chrome.send('loadWallpaper', [this.lastFocusedPod_.user.username]);
3198 }, 3172 },
3199 3173
(...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after
3563 if (pod && pod.multiProfilesPolicyApplied) { 3537 if (pod && pod.multiProfilesPolicyApplied) {
3564 pod.userTypeBubbleElement.classList.remove('bubble-shown'); 3538 pod.userTypeBubbleElement.classList.remove('bubble-shown');
3565 } 3539 }
3566 } 3540 }
3567 }; 3541 };
3568 3542
3569 return { 3543 return {
3570 PodRow: PodRow 3544 PodRow: PodRow
3571 }; 3545 };
3572 }); 3546 });
OLDNEW
« no previous file with comments | « ui/login/account_picker/user_pod_row.css ('k') | ui/login/account_picker/user_pod_template.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698