Chromium Code Reviews| 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 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 275 /** | 275 /** |
| 276 * Restores input focus to currently selected pod. | 276 * Restores input focus to currently selected pod. |
| 277 */ | 277 */ |
| 278 Oobe.refocusCurrentPod = function() { | 278 Oobe.refocusCurrentPod = function() { |
| 279 DisplayManager.refocusCurrentPod(); | 279 DisplayManager.refocusCurrentPod(); |
| 280 }; | 280 }; |
| 281 | 281 |
| 282 /** | 282 /** |
| 283 * Some ForTesting APIs directly access to DOM. Because this script is loaded | 283 * Some ForTesting APIs directly access to DOM. Because this script is loaded |
| 284 * in header, DOM tree may not be available at beginning. | 284 * in header, DOM tree may not be available at beginning. |
| 285 * In DOMContentLoaded, this is marked to true, indicating ForTesting methods | 285 * This is initialized to null, indicating that DOM is not yet loaded. Then |
| 286 * can be called. | 286 * marked to "true" on success of Oobe initialization, or "false" on failure, |
| 287 * which runs after DOM loading is done. | |
| 288 * If "true" is set, external scripts can call ForTesting APIs defined in | |
| 289 * this module. | |
| 290 * Note that "false" is explicitly set there to notify the caller that | |
| 291 * the initialization is failed, so it is not necessary to wait for timeout. | |
| 287 * External script using ForTesting APIs should wait for this condition. | 292 * External script using ForTesting APIs should wait for this condition. |
| 288 * @type {boolean} | 293 * @type {?boolean} |
| 289 */ | 294 */ |
| 290 Oobe.readyForTesting = false; | 295 Oobe.readyForTesting = null; |
| 291 | 296 |
| 292 /** | 297 /** |
| 293 * Skip to login screen for telemetry. | 298 * Skip to login screen for telemetry. |
| 294 */ | 299 */ |
| 295 Oobe.skipToLoginForTesting = function() { | 300 Oobe.skipToLoginForTesting = function() { |
| 296 Oobe.disableSigninUI(); | 301 Oobe.disableSigninUI(); |
| 297 chrome.send('skipToLoginForTesting'); | 302 chrome.send('skipToLoginForTesting'); |
| 298 }; | 303 }; |
| 299 | 304 |
| 300 /** | 305 /** |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 442 return src instanceof HTMLTextAreaElement || | 447 return src instanceof HTMLTextAreaElement || |
| 443 src instanceof HTMLInputElement && | 448 src instanceof HTMLInputElement && |
| 444 /text|password|search/.test(src.type); | 449 /text|password|search/.test(src.type); |
| 445 }); | 450 }); |
| 446 | 451 |
| 447 | 452 |
| 448 (function() { | 453 (function() { |
| 449 'use strict'; | 454 'use strict'; |
| 450 | 455 |
| 451 document.addEventListener('DOMContentLoaded', function() { | 456 document.addEventListener('DOMContentLoaded', function() { |
| 452 Oobe.initialize(); | 457 try { |
| 453 Oobe.readyForTesting = true; | 458 Oobe.initialize(); |
|
achuithb
2017/04/17 08:42:08
What happens if you move this line to before Oobe.
hidehiko
2017/04/17 09:32:27
Acknowledged.
| |
| 459 Oobe.readyForTesting = true; | |
| 460 } catch (e) { | |
| 461 Oobe.readyForTesting = false; | |
| 462 throw e; | |
| 463 } | |
| 454 }); | 464 }); |
| 455 | 465 |
| 456 // Install a global error handler so stack traces are included in logs. | 466 // Install a global error handler so stack traces are included in logs. |
| 457 window.onerror = function(message, file, line, column, error) { | 467 window.onerror = function(message, file, line, column, error) { |
| 458 console.error(error.stack); | 468 console.error(error.stack); |
| 459 } | 469 } |
| 460 })(); | 470 })(); |
| OLD | NEW |