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

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: Fixed patch set 6 errors. 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 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 1869 matching lines...) Expand 10 before | Expand all | Expand 10 after
2975 // One more iteration if it's not enough cells to place all pods. 2977 // One more iteration if it's not enough cells to place all pods.
2976 while (maxWidth >= this.columnsToWidth_(columns + 1) && 2978 while (maxWidth >= this.columnsToWidth_(columns + 1) &&
2977 columns * rows < this.pods.length && 2979 columns * rows < this.pods.length &&
2978 columns < MAX_NUMBER_OF_COLUMNS) { 2980 columns < MAX_NUMBER_OF_COLUMNS) {
2979 ++columns; 2981 ++columns;
2980 } 2982 }
2981 return {columns: columns, rows: rows}; 2983 return {columns: columns, rows: rows};
2982 }, 2984 },
2983 2985
2984 /** 2986 /**
2985 * Calculates the row and column of the given |pod|.
2986 * @param {UserPod} pod Pod we want the row and column of.
2987 * @param {number} columns Columns in the podrow.
2988 * @param {number} rows Rows in the podrow.
2989 * @return {{columns: number, rows: number}}
2990 * @private
2991 */
2992 findPodLocation_: function(pod, columns, rows) {
2993 var column = -1;
2994 var row = -1;
2995 var index = this.pods.indexOf(pod);
2996 if (index >= 0) {
2997 row = Math.floor(index / columns);
2998 column = index % columns;
2999 }
3000 else {
3001 console.error('Pod not found in pod row.');
3002 }
3003 return {column: column, row: row};
3004 },
3005
3006 /**
3007 * Places pods onto their positions onto pod grid. 2987 * Places pods onto their positions onto pod grid.
3008 * @private 2988 * @private
3009 */ 2989 */
3010 placePods_: function() { 2990 placePods_: function() {
3011 var isDesktopUserManager = Oobe.getInstance().displayType == 2991 var isDesktopUserManager = Oobe.getInstance().displayType ==
3012 DISPLAY_TYPE.DESKTOP_USER_MANAGER; 2992 DISPLAY_TYPE.DESKTOP_USER_MANAGER;
3013 if (isDesktopUserManager && !Oobe.getInstance().userPodsPageVisible) 2993 if (isDesktopUserManager && !Oobe.getInstance().userPodsPageVisible)
3014 return; 2994 return;
3015 2995
3016 var layout = this.calculateLayout_(); 2996 var layout = this.calculateLayout_();
(...skipping 14 matching lines...) Expand all
3031 if (index >= maxPodsNumber) { 3011 if (index >= maxPodsNumber) {
3032 pod.hidden = true; 3012 pod.hidden = true;
3033 return; 3013 return;
3034 } 3014 }
3035 pod.hidden = false; 3015 pod.hidden = false;
3036 if (pod.offsetHeight != height && 3016 if (pod.offsetHeight != height &&
3037 pod.offsetHeight != CROS_PIN_POD_HEIGHT) { 3017 pod.offsetHeight != CROS_PIN_POD_HEIGHT) {
3038 console.error('Pod offsetHeight (' + pod.offsetHeight + 3018 console.error('Pod offsetHeight (' + pod.offsetHeight +
3039 ') and POD_HEIGHT (' + height + ') are not equal.'); 3019 ') and POD_HEIGHT (' + height + ') are not equal.');
3040 } 3020 }
3041 if (pod.offsetWidth != width && 3021 if (pod.offsetWidth != width) {
3042 pod.offsetWidth != CROS_PIN_POD_WIDTH) {
3043 console.error('Pod offsetWidth (' + pod.offsetWidth + 3022 console.error('Pod offsetWidth (' + pod.offsetWidth +
3044 ') and POD_WIDTH (' + width + ') are not equal.'); 3023 ') and POD_WIDTH (' + width + ') are not equal.');
3045 } 3024 }
3046 var column = index % columns; 3025 var column = index % columns;
3047 var row = Math.floor(index / columns); 3026 var row = Math.floor(index / columns);
3048 var offsetFromPin = 0;
3049 if (row == pinPodLocation.row) {
3050 offsetFromPin = PIN_EXTRA_WIDTH / 2;
3051 if (column <= pinPodLocation.column)
3052 offsetFromPin *= -1;
3053 }
3054 3027
3055 var rowPadding = isDesktopUserManager ? DESKTOP_ROW_PADDING : 3028 var rowPadding = isDesktopUserManager ? DESKTOP_ROW_PADDING :
3056 POD_ROW_PADDING; 3029 POD_ROW_PADDING;
3057 pod.left = rowPadding + column * (width + margin) + offsetFromPin; 3030 pod.left = rowPadding + column * (width + margin);
3058 3031
3059 // On desktop, we want the rows to always be equally spaced. 3032 // On desktop, we want the rows to always be equally spaced.
3060 pod.top = isDesktopUserManager ? row * (height + rowPadding) : 3033 pod.top = isDesktopUserManager ? row * (height + rowPadding) :
3061 row * height + rowPadding; 3034 row * height + rowPadding;
3062 }); 3035 });
3063 Oobe.getInstance().updateScreenSize(this.parentNode); 3036 Oobe.getInstance().updateScreenSize(this.parentNode);
3064 }, 3037 },
3065 3038
3066 /** 3039 /**
3067 * Number of columns. 3040 * Number of columns.
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
3136 } 3109 }
3137 } 3110 }
3138 3111
3139 // Clear any error messages for previous pod. 3112 // Clear any error messages for previous pod.
3140 if (!this.isFocused(podToFocus)) 3113 if (!this.isFocused(podToFocus))
3141 Oobe.clearErrors(); 3114 Oobe.clearErrors();
3142 3115
3143 var hadFocus = !!this.focusedPod_; 3116 var hadFocus = !!this.focusedPod_;
3144 this.focusedPod_ = podToFocus; 3117 this.focusedPod_ = podToFocus;
3145 if (podToFocus) { 3118 if (podToFocus) {
3146 this.setFocusedPodPinVisibility(true); 3119 // Only show the keyboard if it is fully loaded.
3120 if (podToFocus.isPinReady())
3121 podToFocus.setPinVisibility(true);
3147 podToFocus.classList.remove('faded'); 3122 podToFocus.classList.remove('faded');
3148 podToFocus.classList.add('focused'); 3123 podToFocus.classList.add('focused');
3149 if (!podToFocus.multiProfilesPolicyApplied) { 3124 if (!podToFocus.multiProfilesPolicyApplied) {
3150 podToFocus.classList.toggle('signing-in', false); 3125 podToFocus.classList.toggle('signing-in', false);
3151 if (!opt_skipInputFocus) 3126 if (!opt_skipInputFocus)
3152 podToFocus.focusInput(); 3127 podToFocus.focusInput();
3153 } else { 3128 } else {
3154 podToFocus.userTypeBubbleElement.classList.add('bubble-shown'); 3129 podToFocus.userTypeBubbleElement.classList.add('bubble-shown');
3155 // Note it is not necessary to skip this focus request when 3130 // Note it is not necessary to skip this focus request when
3156 // |opt_skipInputFocus| is true. When |multiProfilesPolicyApplied| 3131 // |opt_skipInputFocus| is true. When |multiProfilesPolicyApplied|
3157 // is false, it doesn't focus on the password input box by default. 3132 // is false, it doesn't focus on the password input box by default.
3158 podToFocus.focus(); 3133 podToFocus.focus();
3159 } 3134 }
3160 3135
3161 // focusPod() automatically loads wallpaper 3136 // focusPod() automatically loads wallpaper
3162 if (!podToFocus.user.isApp) 3137 if (!podToFocus.user.isApp)
3163 chrome.send('focusPod', [podToFocus.user.username]); 3138 chrome.send('focusPod', [podToFocus.user.username]);
3164 this.firstShown_ = false; 3139 this.firstShown_ = false;
3165 this.lastFocusedPod_ = podToFocus; 3140 this.lastFocusedPod_ = podToFocus;
3166 this.scrollFocusedPodIntoView(); 3141 this.scrollFocusedPodIntoView();
3167 } 3142 }
3168 this.insideFocusPod_ = false; 3143 this.insideFocusPod_ = false;
3169 this.placePods_();
3170 }, 3144 },
3171 3145
3172 /** 3146 /**
3173 * Resets wallpaper to the last active user's wallpaper, if any. 3147 * Resets wallpaper to the last active user's wallpaper, if any.
3174 */ 3148 */
3175 loadLastWallpaper: function() { 3149 loadLastWallpaper: function() {
3176 if (this.lastFocusedPod_ && !this.lastFocusedPod_.user.isApp) 3150 if (this.lastFocusedPod_ && !this.lastFocusedPod_.user.isApp)
3177 chrome.send('loadWallpaper', [this.lastFocusedPod_.user.username]); 3151 chrome.send('loadWallpaper', [this.lastFocusedPod_.user.username]);
3178 }, 3152 },
3179 3153
(...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after
3543 if (pod && pod.multiProfilesPolicyApplied) { 3517 if (pod && pod.multiProfilesPolicyApplied) {
3544 pod.userTypeBubbleElement.classList.remove('bubble-shown'); 3518 pod.userTypeBubbleElement.classList.remove('bubble-shown');
3545 } 3519 }
3546 } 3520 }
3547 }; 3521 };
3548 3522
3549 return { 3523 return {
3550 PodRow: PodRow 3524 PodRow: PodRow
3551 }; 3525 };
3552 }); 3526 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698