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

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 3 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 48a7073ad110d478bd66bc14505e630c93751e20..928885504eaa877ae172300795b66646f76e64df 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.
@@ -835,22 +838,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}
*/
@@ -900,14 +887,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}
*/
@@ -924,14 +903,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}
*/
@@ -1137,11 +1108,12 @@ cr.define('login', function() {
},
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];
+ for (var idx = 0; idx < elements_array.length; idx++) {
+ var currentElement = elements_array[idx];
currentElement.classList.toggle('pin-enabled', visible);
currentElement.classList.toggle('pin-disabled', !visible);
}
@@ -1153,6 +1125,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;
@@ -2579,6 +2555,14 @@ cr.define('login', function() {
this.focusedPod_.setPinVisibility(visible);
},
+ isAnyPinShown_: function() {
+ for (var i = 0; i < this.pods.length; ++i) {
+ if (this.pods[i].isPinShown())
+ return true;
+ }
+ return false;
+ },
+
/**
* Runs app with a given id from the list of loaded apps.
* @param {!string} app_id of an app to run.
@@ -3009,25 +2993,50 @@ 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_;
+
+ if (this.isAnyPinShown_()) {
jdufault 2016/07/12 23:37:47 This logic is a bit confusing. 1. isAnyPinShown_
+ this.pods.forEach(function(pod, index) {
+ var column = index % columns;
+ var row = Math.floor(index / columns);
+ if (pod == podWithPin) {
+ pinShownRow = row;
+ pinShownColumn = column;
+ }
+ });
+ }
+
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) :
@@ -3098,6 +3107,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)
@@ -3115,6 +3125,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) {
@@ -3137,6 +3148,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