| 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="md_login_shared.js"> | 9 // <include src="md_login_shared.js"> |
| 10 | 10 |
| 11 /** | 11 /** |
| 12 * Ensures that the pin keyboard is loaded. | 12 * Ensures that the pin keyboard is loaded. |
| 13 * @param {function()} onLoaded Callback run when the pin keyboard is loaded. | 13 * @param {function()} onLoaded Callback run when the pin keyboard is loaded. |
| 14 */ | 14 */ |
| 15 function ensurePinKeyboardLoaded(onLoaded) { | 15 function ensurePinKeyboardLoaded(onLoaded) { |
| 16 'use strict'; | 16 'use strict'; |
| 17 | 17 |
| 18 // The element we want to see if loaded. | 18 // The element we want to see if loaded. |
| 19 var getPinKeyboard = function() { | 19 var getPinKeyboard = function() { |
| 20 return $('pod-row').querySelectorAll('pin-keyboard')[0]; | 20 return $('pod-row').querySelectorAll('pin-keyboard')[0]; |
| 21 }; | 21 }; |
| 22 | 22 |
| 23 // Do not reload assets if they are already loaded. Run |onLoaded| once assets | 23 // Do not reload assets if they are already loaded. Run |onLoaded| once assets |
| 24 // are done loading, though. | 24 // are done loading, though. |
| 25 if (cr.ui.login.ResourceLoader.hasDeferredAssets('custom-elements')) { | 25 if (cr.ui.login.ResourceLoader.hasDeferredAssets('custom-elements')) { |
| 26 cr.ui.login.ResourceLoader.waitUntilLayoutComplete(getPinKeyboard, | 26 cr.ui.login.ResourceLoader.waitUntilLayoutComplete( |
| 27 onLoaded); | 27 getPinKeyboard, onLoaded); |
| 28 return; | 28 return; |
| 29 } | 29 } |
| 30 | 30 |
| 31 // Register loader for custom elements. | 31 // Register loader for custom elements. |
| 32 cr.ui.login.ResourceLoader.registerAssets({ | 32 cr.ui.login.ResourceLoader.registerAssets({ |
| 33 id: 'custom-elements', | 33 id: 'custom-elements', |
| 34 html: [{ url: 'chrome://oobe/custom_elements.html' }] | 34 html: [{url: 'chrome://oobe/custom_elements.html'}] |
| 35 }); | 35 }); |
| 36 | 36 |
| 37 // We only load the PIN element when it is actually shown so that lock screen | 37 // We only load the PIN element when it is actually shown so that lock screen |
| 38 // load times remain low when the user is not using a PIN. | 38 // load times remain low when the user is not using a PIN. |
| 39 // | 39 // |
| 40 // Loading the PIN element blocks the DOM, which will interrupt any running | 40 // Loading the PIN element blocks the DOM, which will interrupt any running |
| 41 // animations. We load the PIN after an idle notification to allow the pod | 41 // animations. We load the PIN after an idle notification to allow the pod |
| 42 // fly-in animation to complete without interruption. | 42 // fly-in animation to complete without interruption. |
| 43 cr.ui.login.ResourceLoader.loadAssetsOnIdle('custom-elements', function() { | 43 cr.ui.login.ResourceLoader.loadAssetsOnIdle('custom-elements', function() { |
| 44 cr.ui.login.ResourceLoader.waitUntilLayoutComplete(getPinKeyboard, | 44 cr.ui.login.ResourceLoader.waitUntilLayoutComplete( |
| 45 onLoaded); | 45 getPinKeyboard, onLoaded); |
| 46 }); | 46 }); |
| 47 } | 47 } |
| 48 | 48 |
| 49 cr.define('cr.ui.Oobe', function() { | 49 cr.define('cr.ui.Oobe', function() { |
| 50 return { | 50 return { |
| 51 /** | 51 /** |
| 52 * Initializes the OOBE flow. This will cause all C++ handlers to | 52 * Initializes the OOBE flow. This will cause all C++ handlers to |
| 53 * be invoked to do final setup. | 53 * be invoked to do final setup. |
| 54 */ | 54 */ |
| 55 initialize: function() { | 55 initialize: function() { |
| (...skipping 30 matching lines...) Expand all Loading... |
| 86 * Reloads content of the page. | 86 * Reloads content of the page. |
| 87 * @param {!Object} data New dictionary with i18n values. | 87 * @param {!Object} data New dictionary with i18n values. |
| 88 */ | 88 */ |
| 89 reloadContent: function(data) { | 89 reloadContent: function(data) { |
| 90 loadTimeData.overrideValues(data); | 90 loadTimeData.overrideValues(data); |
| 91 i18nTemplate.process(document, loadTimeData); | 91 i18nTemplate.process(document, loadTimeData); |
| 92 Oobe.getInstance().updateLocalizedContent_(); | 92 Oobe.getInstance().updateLocalizedContent_(); |
| 93 }, | 93 }, |
| 94 }; | 94 }; |
| 95 }); | 95 }); |
| OLD | NEW |