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

Unified Diff: ui/login/account_picker/user_pod_row.js

Issue 2129253002: Multi-pod support for lock screen. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@lkgr
Patch Set: Fixed patch set 4 errors. Created 4 years, 5 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 side-by-side diff with in-line comments
Download patch
« 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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/login/account_picker/user_pod_row.js
diff --git a/ui/login/account_picker/user_pod_row.js b/ui/login/account_picker/user_pod_row.js
index 912c21b627800894d98c375437371600261c3cf5..a4b09ebb0a67a5d3ac6d9519ec9eacfad1c028e0 100644
--- a/ui/login/account_picker/user_pod_row.js
+++ b/ui/login/account_picker/user_pod_row.js
@@ -59,6 +59,9 @@ cr.define('login', function() {
var POD_ROW_PADDING = 10;
var DESKTOP_ROW_PADDING = 32;
var CUSTOM_ICON_CONTAINER_SIZE = 40;
+ var CROS_PIN_POD_WIDTH = 270;
+ var CROS_PIN_POD_HEIGHT = 594;
+ var PIN_EXTRA_WIDTH = 90;
/**
* Minimal padding between user pod and virtual keyboard.
@@ -820,22 +823,6 @@ cr.define('login', function() {
},
/**
- * Gets the authorization element of the pod.
- * @type {!HTMLDivElement}
- */
- get authElement() {
- return this.querySelector('.auth-container');
- },
-
- /**
- * Gets image pane element.
- * @type {!HTMLDivElement}
- */
- get imagePaneElement() {
- return this.querySelector('.user-image-pane');
- },
-
- /**
* Gets image element.
* @type {!HTMLImageElement}
*/
@@ -885,14 +872,6 @@ cr.define('login', function() {
},
/**
- * Gets the pin-container of the pod.
- * @type {!HTMLDivElement}
- */
- get pinContainer() {
- return this.querySelector('.pin-container');
- },
-
- /**
* Gets the pin-keyboard of the pod.
* @type {!HTMLElement}
*/
@@ -909,14 +888,6 @@ cr.define('login', function() {
},
/**
- * Gets the signed in indicator of the pod.
- * @type {!HTMLDivElement}
- */
- get signInElement() {
- return this.querySelector('.signed-in-indicator');
- },
-
- /**
* Gets the container holding the launch app button.
* @type {!HTMLButtonElement}
*/
@@ -1121,14 +1092,19 @@ cr.define('login', function() {
this.classList.toggle('flying-pin-pod', enable);
},
+ setPinClass_: function(element, enable) {
+ element.classList.toggle('pin-enabled', enable);
+ element.classList.toggle('pin-disabled', !enable);
+ },
+
setPinVisibility: function(visible) {
- var elements = [this, this.authElement, this.imagePaneElement,
- this.imageElement, this.pinContainer];
+ var elements = this.getElementsByClassName('pin-tag');
+ var elements_array = Array.prototype.slice.call(elements);
+ elements_array.push(this);
- for (var idx = 0; idx < elements.length; idx++) {
- var currentElement = elements[idx];
- currentElement.classList.toggle('pin-enabled', visible);
- currentElement.classList.toggle('pin-disabled', !visible);
+ for (var idx = 0; idx < elements_array.length; idx++) {
jdufault 2016/07/18 18:28:44 Iterate over elements directly and add an explicit
sammiequon 2016/07/18 22:34:21 Done.
+ var currentElement = elements_array[idx];
+ this.setPinClass_(currentElement, visible);
}
// Set the focus to the input element after showing/hiding pin keyboard.
@@ -1138,6 +1114,10 @@ cr.define('login', function() {
this.mainInput.focus();
},
+ isPinShown: function() {
+ return this.classList.contains('pin-enabled');
+ },
+
setUserPodIconType: function(userTypeClass) {
this.userTypeIconAreaElement.classList.add(userTypeClass);
this.userTypeIconAreaElement.hidden = false;
@@ -1173,7 +1153,7 @@ cr.define('login', function() {
*/
get mainInput() {
if (this.isAuthTypePassword) {
- if (this.pinContainer.classList.contains('pin-enabled'))
+ if (this.isPinShown() && this.pinKeyboard.inputElement)
return this.pinKeyboard.inputElement;
return this.passwordElement;
} else if (this.isAuthTypeOnlineSignIn) {
@@ -3002,25 +2982,54 @@ cr.define('login', function() {
this.columnsToWidth_(columns), this.rowsToHeight_(rows));
var height = this.userPodHeight_;
var width = this.userPodWidth_;
+
+ var pinShownRow = maxPodsNumber + 1;
+ var pinShownColumn = maxPodsNumber + 1;
+ var podWithPin = this.focusedPod_;
jdufault 2016/07/18 18:28:44 What about extracting this logic into a helper fun
sammiequon 2016/07/18 22:34:21 Done.
+
+ if (podWithPin && podWithPin.isPinShown()) {
+ this.pods.forEach(function(pod, index) {
+ var column = index % columns;
+ var row = Math.floor(index / columns);
+ if (pod == podWithPin) {
+ pinShownRow = row;
+ pinShownColumn = column;
+ } else if (pod.isPinShown()) {
+ // Only the focused pod should ever show the PIN keyboard.
+ console.error('Pod that is not the focused pod is showing its' +
jdufault 2016/07/18 18:28:44 nit: add space after its Or what about: consol
sammiequon 2016/07/18 22:34:21 Done.
+ 'PIN keyboard.');
+ }
+ });
+ }
+
this.pods.forEach(function(pod, index) {
if (index >= maxPodsNumber) {
pod.hidden = true;
return;
}
pod.hidden = false;
- if (pod.offsetHeight != height) {
+ if (pod.offsetHeight != height &&
+ pod.offsetHeight != CROS_PIN_POD_HEIGHT) {
console.error('Pod offsetHeight (' + pod.offsetHeight +
') and POD_HEIGHT (' + height + ') are not equal.');
}
- if (pod.offsetWidth != width) {
+ if (pod.offsetWidth != width &&
+ pod.offsetWidth != CROS_PIN_POD_WIDTH) {
console.error('Pod offsetWidth (' + pod.offsetWidth +
') and POD_WIDTH (' + width + ') are not equal.');
}
var column = index % columns;
var row = Math.floor(index / columns);
+ var offsetFromPin = 0;
+ if (row == pinShownRow) {
+ offsetFromPin = PIN_EXTRA_WIDTH / 2;
+ if (column <= pinShownColumn)
+ offsetFromPin *= -1;
+ }
+
var rowPadding = isDesktopUserManager ? DESKTOP_ROW_PADDING :
POD_ROW_PADDING;
- pod.left = rowPadding + column * (width + margin);
+ pod.left = rowPadding + column * (width + margin) + offsetFromPin;
// On desktop, we want the rows to always be equally spaced.
pod.top = isDesktopUserManager ? row * (height + rowPadding) :
@@ -3091,6 +3100,7 @@ cr.define('login', function() {
if (pod != podToFocus) {
pod.isActionBoxMenuHovered = false;
pod.classList.remove('focused');
+ pod.setPinVisibility(false);
// On Desktop, the faded style is not set correctly, so we should
// manually fade out non-focused pods if there is a focused pod.
if (pod.user.isDesktopUser && podToFocus)
@@ -3108,6 +3118,7 @@ cr.define('login', function() {
var hadFocus = !!this.focusedPod_;
this.focusedPod_ = podToFocus;
if (podToFocus) {
+ this.setFocusedPodPinVisibility(true);
podToFocus.classList.remove('faded');
podToFocus.classList.add('focused');
if (!podToFocus.multiProfilesPolicyApplied) {
@@ -3130,6 +3141,7 @@ cr.define('login', function() {
this.scrollFocusedPodIntoView();
}
this.insideFocusPod_ = false;
+ this.placePods_();
},
/**
« 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