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

Unified Diff: chrome/browser/resources/chromeos/login/lock.js

Issue 2785003002: cros: Showing pin on lock is no longer associated with sending user list. (Closed)
Patch Set: Address comments Created 3 years, 8 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
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 9eb6fe0c1906cc713107446f4de23564a3dc672b..f6b821e1aa83c4639c720fc26e168b85cbaccdae 100644
--- a/chrome/browser/resources/chromeos/login/lock.js
+++ b/chrome/browser/resources/chromeos/login/lock.js
@@ -9,16 +9,24 @@
// <include src="login_shared.js">
/**
- * Asynchronously loads the pin keyboard.
+ * Ensures that the pin keyboard is loaded.
+ * @param {function()} onLoaded Callback run when the pin keyboard is loaded.
*/
-function showPinKeyboardAsync() {
+function ensurePinKeyboardLoaded(onLoaded) {
'use strict';
- // 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.hasDeferredAssets('custom-elements'))
+ // The element we want to see if loaded.
+ var getPinKeyboard = function() {
+ return $('pod-row').querySelectorAll('pin-keyboard')[0];
+ };
+
+ // Do not reload assets if they are already loaded. Run |onLoaded| once assets
+ // are done loading, though.
+ if (cr.ui.login.ResourceLoader.hasDeferredAssets('custom-elements')) {
+ cr.ui.login.ResourceLoader.waitUntilLayoutComplete(getPinKeyboard,
+ onLoaded);
return;
+ }
// Register loader for custom elements.
cr.ui.login.ResourceLoader.registerAssets({
@@ -26,18 +34,6 @@ function showPinKeyboardAsync() {
html: [{ url: 'chrome://oobe/custom_elements.html' }]
});
- // Called after polymer has been loaded. Fades the pin element in.
- var onPinLoaded = function(pinKeyboard) {
- var podRow = $('pod-row');
- podRow.toggleTransitions(true);
- podRow.setFocusedPodPinVisibility(true);
- };
-
- // The element we want to see if loaded.
- var getPinKeyboard = function() {
- return $('pod-row').querySelectorAll('pin-keyboard')[0];
- };
-
// We only load the PIN element when it is actually shown so that lock screen
// load times remain low when the user is not using a PIN.
//
@@ -46,7 +42,7 @@ function showPinKeyboardAsync() {
// fly-in animation to complete without interruption.
cr.ui.login.ResourceLoader.loadAssetsOnIdle('custom-elements', function() {
cr.ui.login.ResourceLoader.waitUntilLayoutComplete(getPinKeyboard,
- onPinLoaded);
+ onLoaded);
});
}
@@ -71,7 +67,7 @@ cr.define('cr.ui.Oobe', function() {
* lock session so it should also get preloaded.
*/
preloadPinKeyboard: function() {
- showPinKeyboardAsync();
+ ensurePinKeyboardLoaded(function() {});
},
// Dummy Oobe functions not present with stripped login UI.

Powered by Google App Engine
This is Rietveld 408576698