| OLD | NEW |
| 1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 /** | 5 /** |
| 6 * @fileoverview Login UI based on a stripped down OOBE controller. | 6 * @fileoverview Login UI based on a stripped down OOBE controller. |
| 7 */ | 7 */ |
| 8 | 8 |
| 9 <include src="login_shared.js"> | 9 <include src="login_shared.js"> |
| 10 | 10 |
| 11 // Lazy load polymer. | 11 // Asynchronously loads the pin keyboard. |
| 12 (function() { | 12 function showPinKeyboardAsync() { |
| 13 'use strict'; | 13 'use strict'; |
| 14 | 14 |
| 15 // This function could get called multiple times. Do nothing if we have |
| 16 // already loaded. This check needs to happen before the registerAssets call, |
| 17 // because that will clobber the loaded state. |
| 18 if (cr.ui.login.ResourceLoader.alreadyLoadedAssets('custom-elements')) |
| 19 return; |
| 20 |
| 15 // Register loader for custom elements. | 21 // Register loader for custom elements. |
| 16 cr.ui.login.ResourceLoader.registerAssets({ | 22 cr.ui.login.ResourceLoader.registerAssets({ |
| 17 id: 'custom-elements', | 23 id: 'custom-elements', |
| 18 html: [{ url: 'chrome://oobe/custom_elements.html' }] | 24 html: [{ url: 'chrome://oobe/custom_elements.html' }] |
| 19 }); | 25 }); |
| 20 | 26 |
| 21 // Called after polymer has been loaded. Fades the pin element in. | 27 // Called after polymer has been loaded. Fades the pin element in. |
| 22 var onPinLoaded = function(pinContainer) { | 28 var onPinLoaded = function(pinContainer) { |
| 23 pinContainer.style.opacity = 1; | 29 pinContainer.style.opacity = 1; |
| 24 }; | 30 }; |
| 25 | 31 |
| 26 // We only load the PIN element when it is actually shown so that lock screen | 32 // We only load the PIN element when it is actually shown so that lock screen |
| 27 // load times remain low when the user is not using a PIN. | 33 // load times remain low when the user is not using a PIN. |
| 28 // | 34 // |
| 29 // Loading the PIN element blocks the DOM, which will interrupt any running | 35 // Loading the PIN element blocks the DOM, which will interrupt any running |
| 30 // animations. We load the PIN after an idle notification to allow the pod | 36 // animations. We load the PIN after an idle notification to allow the pod |
| 31 // fly-in animation to complete without interruption. | 37 // fly-in animation to complete without interruption. |
| 32 if (loadTimeData.getBoolean('showPin')) { | 38 cr.ui.login.ResourceLoader.loadAssetsOnIdle('custom-elements', function() { |
| 33 cr.ui.login.ResourceLoader.loadAssetsOnIdle('custom-elements', function() { | 39 cr.ui.login.ResourceLoader.waitUntilLayoutComplete('pin-container', |
| 34 cr.ui.login.ResourceLoader.waitUntilLayoutComplete('pin-container', | 40 onPinLoaded); |
| 35 onPinLoaded); | 41 }); |
| 36 }); | 42 } |
| 37 } | |
| 38 })(); | |
| 39 | 43 |
| 40 cr.define('cr.ui.Oobe', function() { | 44 cr.define('cr.ui.Oobe', function() { |
| 41 return { | 45 return { |
| 42 /** | 46 /** |
| 43 * Initializes the OOBE flow. This will cause all C++ handlers to | 47 * Initializes the OOBE flow. This will cause all C++ handlers to |
| 44 * be invoked to do final setup. | 48 * be invoked to do final setup. |
| 45 */ | 49 */ |
| 46 initialize: function() { | 50 initialize: function() { |
| 47 // TODO(jdufault): Remove this after resolving crbug.com/452599. | 51 // TODO(jdufault): Remove this after resolving crbug.com/452599. |
| 48 console.log('Start initializing LOCK OOBE'); | 52 console.log('Start initializing LOCK OOBE'); |
| (...skipping 22 matching lines...) Expand all Loading... |
| 71 * Reloads content of the page. | 75 * Reloads content of the page. |
| 72 * @param {!Object} data New dictionary with i18n values. | 76 * @param {!Object} data New dictionary with i18n values. |
| 73 */ | 77 */ |
| 74 reloadContent: function(data) { | 78 reloadContent: function(data) { |
| 75 loadTimeData.overrideValues(data); | 79 loadTimeData.overrideValues(data); |
| 76 i18nTemplate.process(document, loadTimeData); | 80 i18nTemplate.process(document, loadTimeData); |
| 77 Oobe.getInstance().updateLocalizedContent_(); | 81 Oobe.getInstance().updateLocalizedContent_(); |
| 78 }, | 82 }, |
| 79 }; | 83 }; |
| 80 }); | 84 }); |
| OLD | NEW |