| 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 // Lazy load polymer. |
| 12 (function() { | 12 (function() { |
| 13 'use strict'; | 13 'use strict'; |
| 14 | 14 |
| 15 // Register loader for custom elements. | 15 // Register loader for custom elements. |
| 16 cr.ui.login.ResourceLoader.registerAssets({ | 16 cr.ui.login.ResourceLoader.registerAssets({ |
| 17 id: 'custom-elements', | 17 id: 'custom-elements', |
| 18 html: [{ url: 'chrome://oobe/custom_elements.html' }] | 18 html: [{ url: 'chrome://oobe/custom_elements.html' }] |
| 19 }); | 19 }); |
| 20 | 20 |
| 21 // Called after polymer has been loaded. Fades the pin element in. | 21 // Called after polymer has been loaded. Fades the pin element in. |
| 22 var onPolymerLoaded = function() { | 22 var onPinLoaded = function(pinContainer) { |
| 23 var pinContainer = $('pin-container'); | |
| 24 pinContainer.style.opacity = 1; | 23 pinContainer.style.opacity = 1; |
| 25 }; | 24 }; |
| 26 | 25 |
| 27 // We only load the PIN element when it is actually shown so that lock screen | 26 // We only load the PIN element when it is actually shown so that lock screen |
| 28 // load times remain low when the user is not using a PIN. | 27 // load times remain low when the user is not using a PIN. |
| 29 // | 28 // |
| 30 // Loading the PIN element blocks the DOM, which will interrupt any running | 29 // Loading the PIN element blocks the DOM, which will interrupt any running |
| 31 // animations. We load the PIN after an idle notification to allow the pod | 30 // animations. We load the PIN after an idle notification to allow the pod |
| 32 // fly-in animation to complete without interruption. | 31 // fly-in animation to complete without interruption. |
| 33 if (loadTimeData.getBoolean('showPin')) { | 32 if (loadTimeData.getBoolean('showPin')) { |
| 34 cr.ui.login.ResourceLoader.loadAssetsOnIdle('custom-elements', | 33 cr.ui.login.ResourceLoader.loadAssetsOnIdle('custom-elements', function() { |
| 35 onPolymerLoaded); | 34 cr.ui.login.ResourceLoader.waitUntilLayoutComplete('pin-container', |
| 35 onPinLoaded); |
| 36 }); |
| 36 } | 37 } |
| 37 })(); | 38 })(); |
| 38 | 39 |
| 39 cr.define('cr.ui.Oobe', function() { | 40 cr.define('cr.ui.Oobe', function() { |
| 40 return { | 41 return { |
| 41 /** | 42 /** |
| 42 * Initializes the OOBE flow. This will cause all C++ handlers to | 43 * Initializes the OOBE flow. This will cause all C++ handlers to |
| 43 * be invoked to do final setup. | 44 * be invoked to do final setup. |
| 44 */ | 45 */ |
| 45 initialize: function() { | 46 initialize: function() { |
| (...skipping 24 matching lines...) Expand all Loading... |
| 70 * Reloads content of the page. | 71 * Reloads content of the page. |
| 71 * @param {!Object} data New dictionary with i18n values. | 72 * @param {!Object} data New dictionary with i18n values. |
| 72 */ | 73 */ |
| 73 reloadContent: function(data) { | 74 reloadContent: function(data) { |
| 74 loadTimeData.overrideValues(data); | 75 loadTimeData.overrideValues(data); |
| 75 i18nTemplate.process(document, loadTimeData); | 76 i18nTemplate.process(document, loadTimeData); |
| 76 Oobe.getInstance().updateLocalizedContent_(); | 77 Oobe.getInstance().updateLocalizedContent_(); |
| 77 }, | 78 }, |
| 78 }; | 79 }; |
| 79 }); | 80 }); |
| OLD | NEW |