| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 An UI component to host gaia auth extension in an iframe. | 6 * @fileoverview An UI component to host gaia auth extension in an iframe. |
| 7 * After the component binds with an iframe, call its {@code load} to start the | 7 * After the component binds with an iframe, call its {@code load} to start the |
| 8 * authentication flow. There are two events would be raised after this point: | 8 * authentication flow. There are two events would be raised after this point: |
| 9 * a 'ready' event when the authentication UI is ready to use and a 'completed' | 9 * a 'ready' event when the authentication UI is ready to use and a 'completed' |
| 10 * event when the authentication is completed successfully. If caller is | 10 * event when the authentication is completed successfully. If caller is |
| (...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 335 this.password_ = msg.password; | 335 this.password_ = msg.password; |
| 336 this.chooseWhatToSync_ = msg.chooseWhatToSync; | 336 this.chooseWhatToSync_ = msg.chooseWhatToSync; |
| 337 return; | 337 return; |
| 338 } | 338 } |
| 339 | 339 |
| 340 if (!this.isAuthExtMessage_(e)) | 340 if (!this.isAuthExtMessage_(e)) |
| 341 return; | 341 return; |
| 342 | 342 |
| 343 if (msg.method == 'loginUILoaded') { | 343 if (msg.method == 'loginUILoaded') { |
| 344 cr.dispatchSimpleEvent(this, 'ready'); | 344 cr.dispatchSimpleEvent(this, 'ready'); |
| 345 // Declare __login_ui_initialized in window object so it could be read |
| 346 // directly in telemetry tests. |
| 347 if (msg.load_start_ts && !window.__login_ui_initialized) { |
| 348 chrome.send('loginUIInitialized', |
| 349 [msg.load_start_ts, msg.load_stop_ts]); |
| 350 window.__login_ui_initialized = true; |
| 351 } |
| 345 return; | 352 return; |
| 346 } | 353 } |
| 347 | 354 |
| 348 if (/^complete(Login|Authentication)$|^offlineLogin$/.test(msg.method)) { | 355 if (/^complete(Login|Authentication)$|^offlineLogin$/.test(msg.method)) { |
| 349 if (!msg.email && !this.email_ && !msg.skipForNow) { | 356 if (!msg.email && !this.email_ && !msg.skipForNow) { |
| 350 var msg = {method: 'redirectToSignin'}; | 357 var msg = {method: 'redirectToSignin'}; |
| 351 this.frame_.contentWindow.postMessage(msg, AUTH_URL_BASE); | 358 this.frame_.contentWindow.postMessage(msg, AUTH_URL_BASE); |
| 352 return; | 359 return; |
| 353 } | 360 } |
| 354 this.onAuthSuccess_({email: msg.email || this.email_, | 361 this.onAuthSuccess_({email: msg.email || this.email_, |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 436 | 443 |
| 437 GaiaAuthHost.SUPPORTED_PARAMS = SUPPORTED_PARAMS; | 444 GaiaAuthHost.SUPPORTED_PARAMS = SUPPORTED_PARAMS; |
| 438 GaiaAuthHost.LOCALIZED_STRING_PARAMS = LOCALIZED_STRING_PARAMS; | 445 GaiaAuthHost.LOCALIZED_STRING_PARAMS = LOCALIZED_STRING_PARAMS; |
| 439 GaiaAuthHost.AuthMode = AuthMode; | 446 GaiaAuthHost.AuthMode = AuthMode; |
| 440 GaiaAuthHost.AuthFlow = AuthFlow; | 447 GaiaAuthHost.AuthFlow = AuthFlow; |
| 441 | 448 |
| 442 return { | 449 return { |
| 443 GaiaAuthHost: GaiaAuthHost | 450 GaiaAuthHost: GaiaAuthHost |
| 444 }; | 451 }; |
| 445 }); | 452 }); |
| OLD | NEW |