OLD | NEW |
---|---|
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 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 Common OOBE controller methods. This method is shared between | 6 * @fileoverview Common OOBE controller methods. This method is shared between |
7 * OOBE, login, and the lock screen. Add only methods that need to be shared | 7 * OOBE, login, and the lock screen. Add only methods that need to be shared |
8 * between all *three* screens here, as each additional method increases the | 8 * between all *three* screens here, as each additional method increases the |
9 * time it takes to show the lock screen. | 9 * time it takes to show the lock screen. |
10 * | 10 * |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
45 */ | 45 */ |
46 var HEADER_BAR_DELAY_MS = 300; | 46 var HEADER_BAR_DELAY_MS = 300; |
47 | 47 |
48 cr.addSingletonGetter(Oobe); | 48 cr.addSingletonGetter(Oobe); |
49 | 49 |
50 Oobe.prototype = { | 50 Oobe.prototype = { |
51 __proto__: DisplayManager.prototype, | 51 __proto__: DisplayManager.prototype, |
52 }; | 52 }; |
53 | 53 |
54 /** | 54 /** |
55 * Some ForTesting APIs directly access to DOM. Because this script is loaded | |
56 * in header, DOM tree may not be available at beginning. | |
57 * In DOMContentLoaded, this is marked to true, indicating ForTesting methods | |
58 * can be called. | |
59 * External script using ForTesting APIs should wait for this condition. | |
60 * @type {boolean} | |
61 */ | |
62 Oobe.readyForTesting = false; | |
63 | |
64 /** | |
55 * Handle accelerators. These are passed from native code instead of a JS | 65 * Handle accelerators. These are passed from native code instead of a JS |
56 * event handler in order to make sure that embedded iframes cannot swallow | 66 * event handler in order to make sure that embedded iframes cannot swallow |
57 * them. | 67 * them. |
58 * @param {string} name Accelerator name. | 68 * @param {string} name Accelerator name. |
59 */ | 69 */ |
60 Oobe.handleAccelerator = function(name) { | 70 Oobe.handleAccelerator = function(name) { |
61 Oobe.getInstance().handleAccelerator(name); | 71 Oobe.getInstance().handleAccelerator(name); |
62 }; | 72 }; |
63 | 73 |
64 /** | 74 /** |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
275 /** | 285 /** |
276 * Restores input focus to currently selected pod. | 286 * Restores input focus to currently selected pod. |
277 */ | 287 */ |
278 Oobe.refocusCurrentPod = function() { | 288 Oobe.refocusCurrentPod = function() { |
279 DisplayManager.refocusCurrentPod(); | 289 DisplayManager.refocusCurrentPod(); |
280 }; | 290 }; |
281 | 291 |
282 /** | 292 /** |
283 * Skip to login screen for telemetry. | 293 * Skip to login screen for telemetry. |
284 */ | 294 */ |
285 Oobe.skipToLoginForTesting = function() { | 295 Oobe.skipToLoginForTesting = function() { |
achuithb
2017/04/07 08:56:02
We have a number of testing methods here. Can you
hidehiko
2017/04/07 09:09:41
Do you mean moving readyForTesting like PS2? Assum
| |
286 Oobe.disableSigninUI(); | 296 Oobe.disableSigninUI(); |
287 chrome.send('skipToLoginForTesting'); | 297 chrome.send('skipToLoginForTesting'); |
288 }; | 298 }; |
289 | 299 |
290 /** | 300 /** |
291 * Login for telemetry. | 301 * Login for telemetry. |
292 * @param {string} username Login username. | 302 * @param {string} username Login username. |
293 * @param {string} password Login password. | 303 * @param {string} password Login password. |
294 * @param {boolean} enterpriseEnroll Login as an enterprise enrollment? | 304 * @param {boolean} enterpriseEnroll Login as an enterprise enrollment? |
295 */ | 305 */ |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
433 src instanceof HTMLInputElement && | 443 src instanceof HTMLInputElement && |
434 /text|password|search/.test(src.type); | 444 /text|password|search/.test(src.type); |
435 }); | 445 }); |
436 | 446 |
437 | 447 |
438 (function() { | 448 (function() { |
439 'use strict'; | 449 'use strict'; |
440 | 450 |
441 document.addEventListener('DOMContentLoaded', function() { | 451 document.addEventListener('DOMContentLoaded', function() { |
442 Oobe.initialize(); | 452 Oobe.initialize(); |
453 Oobe.readyForTesting = true; | |
443 }); | 454 }); |
444 | 455 |
445 // Install a global error handler so stack traces are included in logs. | 456 // Install a global error handler so stack traces are included in logs. |
446 window.onerror = function(message, file, line, column, error) { | 457 window.onerror = function(message, file, line, column, error) { |
447 console.error(error.stack); | 458 console.error(error.stack); |
448 } | 459 } |
449 })(); | 460 })(); |
450 | |
OLD | NEW |