Chromium Code Reviews| Index: chrome/browser/resources/chromeos/login/lock.js |
| diff --git a/chrome/browser/resources/chromeos/login/lock.js b/chrome/browser/resources/chromeos/login/lock.js |
| index adb71c49a8b62117f92fff7a43b238a6792fcb22..aa41193a19d575182a2d7834a64637c1be78eb94 100644 |
| --- a/chrome/browser/resources/chromeos/login/lock.js |
| +++ b/chrome/browser/resources/chromeos/login/lock.js |
| @@ -8,15 +8,38 @@ |
| <include src="login_shared.js"> |
| -// Asynchronously loads the pin keyboard. |
| -function showPinKeyboardAsync() { |
| +/** |
| + * Asynchronously loads the pin keyboard. |
| + * @param {Object) userPod Pod to hide/unhide elements. |
| + * @param {boolean} visible Whether to make the pin visible. |
| + */ |
| +function showPinKeyboardAsync(userPod, visible) { |
|
jdufault
2016/06/17 18:54:22
Please rename this function now that it can also h
sammiequon
2016/06/22 23:26:16
Done.
|
| 'use strict'; |
| + var setPinVisibility = function(userPod, visible) { |
|
jdufault
2016/06/17 18:54:22
If the |userPod| and |visible| params are removed
|
| + var elements = [userPod.authElement, userPod.imageElement, |
| + userPod.signInElement, userPod, userPod.pinContainer]; |
|
jdufault
2016/06/17 18:54:22
Make userPod first element in the array?
sammiequon
2016/06/22 23:26:16
Done.
|
| + |
| + for (var idx = 0; idx < elements.length; idx++) { |
| + var currentElement = elements[idx]; |
| + if (visible) { |
| + currentElement.classList.add('pin-enabled'); |
| + currentElement.classList.remove('pin-disabled'); |
| + } |
| + else { |
|
jdufault
2016/06/17 18:54:22
nit: } else {
sammiequon
2016/06/22 23:26:17
Done.
|
| + currentElement.classList.remove('pin-enabled'); |
| + currentElement.classList.add('pin-disabled'); |
| + } |
| + } |
| + }; |
| + |
| // This function could get called multiple times. Do nothing if we have |
| // already loaded. This check needs to happen before the registerAssets call, |
| // because that will clobber the loaded state. |
| - if (cr.ui.login.ResourceLoader.alreadyLoadedAssets('custom-elements')) |
| + if (cr.ui.login.ResourceLoader.alreadyLoadedAssets('custom-elements')) { |
| + setPinVisibility(userPod, visible); |
| return; |
| + } |
| // Register loader for custom elements. |
| cr.ui.login.ResourceLoader.registerAssets({ |
| @@ -26,7 +49,7 @@ function showPinKeyboardAsync() { |
| // Called after polymer has been loaded. Fades the pin element in. |
| var onPinLoaded = function(pinContainer) { |
| - pinContainer.style.opacity = 1; |
| + setPinVisibility(userPod, true); |
|
jdufault
2016/06/17 18:54:22
true should be |visible|, if you call showPinKeybo
|
| }; |
| // We only load the PIN element when it is actually shown so that lock screen |