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

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

Issue 1933913002: Add a very basic PIN UI implementation that is shared between lock and settings. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@lkgr
Patch Set: Address comments, add TODOs Created 4 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 9800faec319595ee3dc148d52b6662c405682dd0..916f3fb679aba2adae85de7167861a111d9350fa 100644
--- a/chrome/browser/resources/chromeos/login/lock.js
+++ b/chrome/browser/resources/chromeos/login/lock.js
@@ -8,6 +8,45 @@
<include src="login_shared.js">
+// Lazy load polymer.
+(function() {
+ 'use strict';
+
+ // How long until we wait for an idle event before forcibly loading polymer.
+ /** @const */ var IDLE_TIMEOUT_MS = 250;
+
+ var onPolymerLoaded = function() {
+ var pinContainer = $('pin-container');
+ pinContainer.style.opacity = 1;
+ };
+
+ // We only need to load polymer on the lock screen if we are showing the PIN
+ // keypad. The PIN keypad is implemented with various paper elements and can
+ // take a significant amount of time to load. Moreover, if the user does not
+ // have PIN unlock enabled, we can skip loading all of polymer.
+ //
+ // Directly loading the element in DOMContentLoaded or load results in the
+ // pod intro animation getting interrupted. Loading it in an idle callback
+ // defers the load enough that the animation does not get interrupted.
+ //
+ // TODO(jdufault): Reevaluate if we need the requestIdleCallback bit if we are
+ // not showing user pods with the PIN keypad.
+ var showPin = loadTimeData.getBoolean('showPin');
+ if (true || showPin) {
tommycli 2016/05/04 19:29:02 leftover true ||
jdufault 2016/05/06 00:05:46 Done.
+ window.addEventListener('DOMContentLoaded', function() {
+ var loadPolymer = function() {
+ var link = document.createElement('link');
+ link.rel = 'import';
+ link.href = 'chrome://oobe/custom_elements.html';
+ link.onload = onPolymerLoaded;
+ document.head.appendChild(link);
+ };
+
+ window.requestIdleCallback(loadPolymer, { timeout: IDLE_TIMEOUT_MS });
+ });
+ }
+})();
+
cr.define('cr.ui.Oobe', function() {
return {
/**

Powered by Google App Engine
This is Rietveld 408576698