OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #include "chrome/browser/ui/webui/chromeos/login/signin_screen_handler.h" | 5 #include "chrome/browser/ui/webui/chromeos/login/signin_screen_handler.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/hash_tables.h" | 10 #include "base/hash_tables.h" |
(...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
445 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 445 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
446 dns_clear_task_running_ = false; | 446 dns_clear_task_running_ = false; |
447 dns_cleared_ = true; | 447 dns_cleared_ = true; |
448 ShowSigninScreenIfReady(); | 448 ShowSigninScreenIfReady(); |
449 } | 449 } |
450 | 450 |
451 void SigninScreenHandler::ShowSigninScreenIfReady() { | 451 void SigninScreenHandler::ShowSigninScreenIfReady() { |
452 if (!dns_cleared_ || !cookies_cleared_) | 452 if (!dns_cleared_ || !cookies_cleared_) |
453 return; | 453 return; |
454 | 454 |
455 LoadAuthExtension(!is_first_attempt_); | 455 LoadAuthExtension(!is_first_attempt_, false); |
456 ShowScreen(kGaiaSigninScreen, NULL); | 456 ShowScreen(kGaiaSigninScreen, NULL); |
457 | 457 |
458 if (is_first_attempt_) { | 458 if (is_first_attempt_) { |
459 is_first_attempt_ = false; | 459 is_first_attempt_ = false; |
460 if (is_first_webui_ready_) | 460 if (is_first_webui_ready_) |
461 HandleLoginWebuiReady(NULL); | 461 HandleLoginWebuiReady(NULL); |
462 } | 462 } |
463 } | 463 } |
464 | 464 |
465 void SigninScreenHandler::LoadAuthExtension(bool force) { | 465 void SigninScreenHandler::LoadAuthExtension(bool force, bool silent_load) { |
466 DictionaryValue params; | 466 DictionaryValue params; |
467 | 467 |
468 params.SetBoolean("forceReload", force); | 468 params.SetBoolean("forceReload", force); |
| 469 params.SetBoolean("silentLoad", silent_load); |
469 params.SetString("startUrl", kGaiaExtStartPage); | 470 params.SetString("startUrl", kGaiaExtStartPage); |
470 params.SetString("email", email_); | 471 params.SetString("email", email_); |
471 email_.clear(); | 472 email_.clear(); |
472 | 473 |
473 params.SetBoolean("createAccount", | 474 params.SetBoolean("createAccount", |
474 UserCrosSettingsProvider::cached_allow_new_user()); | 475 UserCrosSettingsProvider::cached_allow_new_user()); |
475 params.SetBoolean("guestSignin", | 476 params.SetBoolean("guestSignin", |
476 UserCrosSettingsProvider::cached_allow_guest()); | 477 UserCrosSettingsProvider::cached_allow_guest()); |
477 | 478 |
478 const std::string app_locale = g_browser_process->GetApplicationLocale(); | 479 const std::string app_locale = g_browser_process->GetApplicationLocale(); |
479 if (!app_locale.empty()) | 480 if (!app_locale.empty()) |
480 params.SetString("hl", app_locale); | 481 params.SetString("hl", app_locale); |
481 | 482 |
482 params.SetString("gaiaOrigin", GaiaUrls::GetInstance()->gaia_origin_url()); | 483 params.SetString("gaiaOrigin", GaiaUrls::GetInstance()->gaia_origin_url()); |
483 | 484 |
484 // Test automation data: | 485 // Test automation data: |
485 const CommandLine* command_line = CommandLine::ForCurrentProcess(); | 486 const CommandLine* command_line = CommandLine::ForCurrentProcess(); |
486 if (command_line->HasSwitch(switches::kAuthExtensionPath)) { | 487 if (command_line->HasSwitch(switches::kAuthExtensionPath)) { |
487 if (!test_user_.empty()) { | 488 if (!test_user_.empty()) { |
488 params.SetString("test_email", test_user_); | 489 params.SetString("test_email", test_user_); |
489 test_user_.clear(); | 490 test_user_.clear(); |
490 } | 491 } |
491 if (!test_pass_.empty()) { | 492 if (!test_pass_.empty()) { |
492 params.SetString("test_password", test_pass_); | 493 params.SetString("test_password", test_pass_); |
493 test_pass_.clear(); | 494 test_pass_.clear(); |
494 } | 495 } |
495 } | 496 } |
496 web_ui_->CallJavascriptFunction("login.GaiaSigninScreen.setExtensionUrl", | 497 web_ui_->CallJavascriptFunction("login.GaiaSigninScreen.loadAuthExtension", |
497 params); | 498 params); |
498 } | 499 } |
499 | 500 |
500 | 501 |
501 void SigninScreenHandler::ShowSigninScreenForCreds( | 502 void SigninScreenHandler::ShowSigninScreenForCreds( |
502 const std::string& username, | 503 const std::string& username, |
503 const std::string& password) { | 504 const std::string& password) { |
504 VLOG(2) << "ShowSigninScreenForCreds " << username << " " << password; | 505 VLOG(2) << "ShowSigninScreenForCreds " << username << " " << password; |
505 | 506 |
506 test_user_ = username; | 507 test_user_ = username; |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
642 base::FundamentalValue animated_value(animated); | 643 base::FundamentalValue animated_value(animated); |
643 web_ui_->CallJavascriptFunction("login.AccountPickerScreen.loadUsers", | 644 web_ui_->CallJavascriptFunction("login.AccountPickerScreen.loadUsers", |
644 users_list, animated_value); | 645 users_list, animated_value); |
645 } | 646 } |
646 | 647 |
647 void SigninScreenHandler::HandleAccountPickerReady( | 648 void SigninScreenHandler::HandleAccountPickerReady( |
648 const base::ListValue* args) { | 649 const base::ListValue* args) { |
649 // Fetching of the extension is not started before account picker page is | 650 // Fetching of the extension is not started before account picker page is |
650 // loaded because it can affect the loading speed. | 651 // loaded because it can affect the loading speed. |
651 if (is_first_attempt_ && !cookie_remover_ && !dns_clear_task_running_) | 652 if (is_first_attempt_ && !cookie_remover_ && !dns_clear_task_running_) |
652 LoadAuthExtension(true); | 653 LoadAuthExtension(true, true); |
653 } | 654 } |
654 | 655 |
655 void SigninScreenHandler::HandleLoginWebuiReady(const base::ListValue* args) { | 656 void SigninScreenHandler::HandleLoginWebuiReady(const base::ListValue* args) { |
656 if (!is_first_attempt_) { | 657 if (!is_first_attempt_) { |
657 content::NotificationService::current()->Notify( | 658 content::NotificationService::current()->Notify( |
658 chrome::NOTIFICATION_LOGIN_WEBUI_READY, | 659 chrome::NOTIFICATION_LOGIN_WEBUI_READY, |
659 content::NotificationService::AllSources(), | 660 content::NotificationService::AllSources(), |
660 content::NotificationService::NoDetails()); | 661 content::NotificationService::NoDetails()); |
661 } else { | 662 } else { |
662 is_first_webui_ready_ = true; | 663 is_first_webui_ready_ = true; |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
724 | 725 |
725 cookie_remover_ = new BrowsingDataRemover( | 726 cookie_remover_ = new BrowsingDataRemover( |
726 Profile::FromBrowserContext(web_ui_->tab_contents()->browser_context()), | 727 Profile::FromBrowserContext(web_ui_->tab_contents()->browser_context()), |
727 BrowsingDataRemover::EVERYTHING, | 728 BrowsingDataRemover::EVERYTHING, |
728 base::Time()); | 729 base::Time()); |
729 cookie_remover_->AddObserver(this); | 730 cookie_remover_->AddObserver(this); |
730 cookie_remover_->Remove(BrowsingDataRemover::REMOVE_SITE_DATA); | 731 cookie_remover_->Remove(BrowsingDataRemover::REMOVE_SITE_DATA); |
731 } | 732 } |
732 | 733 |
733 } // namespace chromeos | 734 } // namespace chromeos |
OLD | NEW |