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 #include "chrome/browser/ui/webui/signin/user_manager_screen_handler.h" | 5 #include "chrome/browser/ui/webui/signin/user_manager_screen_handler.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/prefs/pref_service.h" | 8 #include "base/prefs/pref_service.h" |
9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "base/value_conversions.h" | 10 #include "base/value_conversions.h" |
(...skipping 678 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
689 | 689 |
690 void UserManagerScreenHandler::ReportAuthenticationResult( | 690 void UserManagerScreenHandler::ReportAuthenticationResult( |
691 bool success, | 691 bool success, |
692 ProfileMetrics::ProfileAuth auth) { | 692 ProfileMetrics::ProfileAuth auth) { |
693 ProfileMetrics::LogProfileAuthResult(auth); | 693 ProfileMetrics::LogProfileAuthResult(auth); |
694 password_attempt_.clear(); | 694 password_attempt_.clear(); |
695 | 695 |
696 if (success) { | 696 if (success) { |
697 ProfileInfoCache& info_cache = | 697 ProfileInfoCache& info_cache = |
698 g_browser_process->profile_manager()->GetProfileInfoCache(); | 698 g_browser_process->profile_manager()->GetProfileInfoCache(); |
699 info_cache.SetProfileSigninRequiredAtIndex( | |
700 authenticating_profile_index_, false); | |
701 base::FilePath path = info_cache.GetPathOfProfileAtIndex( | 699 base::FilePath path = info_cache.GetPathOfProfileAtIndex( |
702 authenticating_profile_index_); | 700 authenticating_profile_index_); |
703 profiles::SwitchToProfile( | 701 profiles::SwitchToProfile( |
704 path, | 702 path, |
705 desktop_type_, | 703 desktop_type_, |
706 true, | 704 true, |
707 base::Bind(&UserManagerScreenHandler::OnSwitchToProfileComplete, | 705 base::Bind(&UserManagerScreenHandler::OnSwitchToProfileComplete, |
708 weak_ptr_factory_.GetWeakPtr()), | 706 weak_ptr_factory_.GetWeakPtr()), |
709 ProfileMetrics::SWITCH_PROFILE_UNLOCK); | 707 ProfileMetrics::SWITCH_PROFILE_UNLOCK); |
710 } else { | 708 } else { |
711 web_ui()->CallJavascriptFunction( | 709 web_ui()->CallJavascriptFunction( |
712 "cr.ui.Oobe.showSignInError", | 710 "cr.ui.Oobe.showSignInError", |
713 base::FundamentalValue(0), | 711 base::FundamentalValue(0), |
714 base::StringValue(l10n_util::GetStringUTF8( | 712 base::StringValue(l10n_util::GetStringUTF8( |
715 auth == ProfileMetrics::AUTH_FAILED_OFFLINE ? | 713 auth == ProfileMetrics::AUTH_FAILED_OFFLINE ? |
716 IDS_LOGIN_ERROR_AUTHENTICATING_OFFLINE : | 714 IDS_LOGIN_ERROR_AUTHENTICATING_OFFLINE : |
717 IDS_LOGIN_ERROR_AUTHENTICATING)), | 715 IDS_LOGIN_ERROR_AUTHENTICATING)), |
718 base::StringValue(""), | 716 base::StringValue(""), |
719 base::FundamentalValue(0)); | 717 base::FundamentalValue(0)); |
720 } | 718 } |
721 } | 719 } |
722 | 720 |
723 void UserManagerScreenHandler::OnBrowserWindowReady(Browser* browser) { | 721 void UserManagerScreenHandler::OnBrowserWindowReady(Browser* browser) { |
724 DCHECK(browser); | 722 DCHECK(browser); |
725 DCHECK(browser->window()); | 723 DCHECK(browser->window()); |
| 724 |
| 725 // Unlock the profile after browser opens so startup can read the lock bit. |
| 726 // Any necessary authentication must have been successful to reach this point. |
| 727 ProfileInfoCache& info_cache = |
| 728 g_browser_process->profile_manager()->GetProfileInfoCache(); |
| 729 size_t index = info_cache.GetIndexOfProfileWithPath( |
| 730 browser->profile()->GetPath()); |
| 731 info_cache.SetProfileSigninRequiredAtIndex(index, false); |
| 732 |
726 if (url_hash_ == profiles::kUserManagerSelectProfileTaskManager) { | 733 if (url_hash_ == profiles::kUserManagerSelectProfileTaskManager) { |
727 base::MessageLoop::current()->PostTask( | 734 base::MessageLoop::current()->PostTask( |
728 FROM_HERE, base::Bind(&chrome::ShowTaskManager, browser)); | 735 FROM_HERE, base::Bind(&chrome::ShowTaskManager, browser)); |
729 } else if (url_hash_ == profiles::kUserManagerSelectProfileAboutChrome) { | 736 } else if (url_hash_ == profiles::kUserManagerSelectProfileAboutChrome) { |
730 base::MessageLoop::current()->PostTask( | 737 base::MessageLoop::current()->PostTask( |
731 FROM_HERE, base::Bind(&chrome::ShowAboutChrome, browser)); | 738 FROM_HERE, base::Bind(&chrome::ShowAboutChrome, browser)); |
732 } | 739 } |
733 | 740 |
734 // This call is last as it deletes this object. | 741 // This call is last as it deletes this object. |
735 UserManager::Hide(); | 742 UserManager::Hide(); |
(...skipping 25 matching lines...) Expand all Loading... |
761 Profile* profile, Profile::CreateStatus profile_create_status) { | 768 Profile* profile, Profile::CreateStatus profile_create_status) { |
762 Browser* browser = chrome::FindAnyBrowser(profile, false, desktop_type_); | 769 Browser* browser = chrome::FindAnyBrowser(profile, false, desktop_type_); |
763 if (browser && browser->window()) { | 770 if (browser && browser->window()) { |
764 OnBrowserWindowReady(browser); | 771 OnBrowserWindowReady(browser); |
765 } else { | 772 } else { |
766 registrar_.Add(this, | 773 registrar_.Add(this, |
767 chrome::NOTIFICATION_BROWSER_WINDOW_READY, | 774 chrome::NOTIFICATION_BROWSER_WINDOW_READY, |
768 content::NotificationService::AllSources()); | 775 content::NotificationService::AllSources()); |
769 } | 776 } |
770 } | 777 } |
OLD | NEW |