| 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 679 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 690 | 690 |
| 691 void UserManagerScreenHandler::ReportAuthenticationResult( | 691 void UserManagerScreenHandler::ReportAuthenticationResult( |
| 692 bool success, | 692 bool success, |
| 693 ProfileMetrics::ProfileAuth auth) { | 693 ProfileMetrics::ProfileAuth auth) { |
| 694 ProfileMetrics::LogProfileAuthResult(auth); | 694 ProfileMetrics::LogProfileAuthResult(auth); |
| 695 password_attempt_.clear(); | 695 password_attempt_.clear(); |
| 696 | 696 |
| 697 if (success) { | 697 if (success) { |
| 698 ProfileInfoCache& info_cache = | 698 ProfileInfoCache& info_cache = |
| 699 g_browser_process->profile_manager()->GetProfileInfoCache(); | 699 g_browser_process->profile_manager()->GetProfileInfoCache(); |
| 700 info_cache.SetProfileSigninRequiredAtIndex( | |
| 701 authenticating_profile_index_, false); | |
| 702 base::FilePath path = info_cache.GetPathOfProfileAtIndex( | 700 base::FilePath path = info_cache.GetPathOfProfileAtIndex( |
| 703 authenticating_profile_index_); | 701 authenticating_profile_index_); |
| 704 profiles::SwitchToProfile( | 702 profiles::SwitchToProfile( |
| 705 path, | 703 path, |
| 706 desktop_type_, | 704 desktop_type_, |
| 707 true, | 705 true, |
| 708 base::Bind(&UserManagerScreenHandler::OnSwitchToProfileComplete, | 706 base::Bind(&UserManagerScreenHandler::OnSwitchToProfileComplete, |
| 709 weak_ptr_factory_.GetWeakPtr()), | 707 weak_ptr_factory_.GetWeakPtr()), |
| 710 ProfileMetrics::SWITCH_PROFILE_UNLOCK); | 708 ProfileMetrics::SWITCH_PROFILE_UNLOCK); |
| 711 } else { | 709 } else { |
| 712 web_ui()->CallJavascriptFunction( | 710 web_ui()->CallJavascriptFunction( |
| 713 "cr.ui.Oobe.showSignInError", | 711 "cr.ui.Oobe.showSignInError", |
| 714 base::FundamentalValue(0), | 712 base::FundamentalValue(0), |
| 715 base::StringValue(l10n_util::GetStringUTF8( | 713 base::StringValue(l10n_util::GetStringUTF8( |
| 716 auth == ProfileMetrics::AUTH_FAILED_OFFLINE ? | 714 auth == ProfileMetrics::AUTH_FAILED_OFFLINE ? |
| 717 IDS_LOGIN_ERROR_AUTHENTICATING_OFFLINE : | 715 IDS_LOGIN_ERROR_AUTHENTICATING_OFFLINE : |
| 718 IDS_LOGIN_ERROR_AUTHENTICATING)), | 716 IDS_LOGIN_ERROR_AUTHENTICATING)), |
| 719 base::StringValue(""), | 717 base::StringValue(""), |
| 720 base::FundamentalValue(0)); | 718 base::FundamentalValue(0)); |
| 721 } | 719 } |
| 722 } | 720 } |
| 723 | 721 |
| 724 void UserManagerScreenHandler::OnBrowserWindowReady(Browser* browser) { | 722 void UserManagerScreenHandler::OnBrowserWindowReady(Browser* browser) { |
| 725 DCHECK(browser); | 723 DCHECK(browser); |
| 726 DCHECK(browser->window()); | 724 DCHECK(browser->window()); |
| 725 |
| 726 // Unlock the profile after browser opens so startup can read the lock bit. |
| 727 // Any necessary authentication must have been successful to reach this point. |
| 728 ProfileInfoCache& info_cache = |
| 729 g_browser_process->profile_manager()->GetProfileInfoCache(); |
| 730 size_t index = info_cache.GetIndexOfProfileWithPath( |
| 731 browser->profile()->GetPath()); |
| 732 info_cache.SetProfileSigninRequiredAtIndex(index, false); |
| 733 |
| 727 if (url_hash_ == profiles::kUserManagerSelectProfileTaskManager) { | 734 if (url_hash_ == profiles::kUserManagerSelectProfileTaskManager) { |
| 728 base::MessageLoop::current()->PostTask( | 735 base::MessageLoop::current()->PostTask( |
| 729 FROM_HERE, base::Bind(&chrome::OpenTaskManager, browser)); | 736 FROM_HERE, base::Bind(&chrome::OpenTaskManager, browser)); |
| 730 } else if (url_hash_ == profiles::kUserManagerSelectProfileAboutChrome) { | 737 } else if (url_hash_ == profiles::kUserManagerSelectProfileAboutChrome) { |
| 731 base::MessageLoop::current()->PostTask( | 738 base::MessageLoop::current()->PostTask( |
| 732 FROM_HERE, base::Bind(&chrome::ShowAboutChrome, browser)); | 739 FROM_HERE, base::Bind(&chrome::ShowAboutChrome, browser)); |
| 733 } else if (url_hash_ == profiles::kUserManagerSelectProfileChromeSettings) { | 740 } else if (url_hash_ == profiles::kUserManagerSelectProfileChromeSettings) { |
| 734 base::MessageLoop::current()->PostTask( | 741 base::MessageLoop::current()->PostTask( |
| 735 FROM_HERE, base::Bind(&chrome::ShowSettings, browser)); | 742 FROM_HERE, base::Bind(&chrome::ShowSettings, browser)); |
| 736 } else if (url_hash_ == profiles::kUserManagerSelectProfileChromeMemory) { | 743 } else if (url_hash_ == profiles::kUserManagerSelectProfileChromeMemory) { |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 768 Profile* profile, Profile::CreateStatus profile_create_status) { | 775 Profile* profile, Profile::CreateStatus profile_create_status) { |
| 769 Browser* browser = chrome::FindAnyBrowser(profile, false, desktop_type_); | 776 Browser* browser = chrome::FindAnyBrowser(profile, false, desktop_type_); |
| 770 if (browser && browser->window()) { | 777 if (browser && browser->window()) { |
| 771 OnBrowserWindowReady(browser); | 778 OnBrowserWindowReady(browser); |
| 772 } else { | 779 } else { |
| 773 registrar_.Add(this, | 780 registrar_.Add(this, |
| 774 chrome::NOTIFICATION_BROWSER_WINDOW_READY, | 781 chrome::NOTIFICATION_BROWSER_WINDOW_READY, |
| 775 content::NotificationService::AllSources()); | 782 content::NotificationService::AllSources()); |
| 776 } | 783 } |
| 777 } | 784 } |
| OLD | NEW |