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/chromeos/login/login_utils.h" | 5 #include "chrome/browser/chromeos/login/login_utils.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
(...skipping 622 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
633 const std::string& password, | 633 const std::string& password, |
634 const GaiaAuthConsumer::ClientLoginResult& credentials, | 634 const GaiaAuthConsumer::ClientLoginResult& credentials, |
635 bool pending_requests, | 635 bool pending_requests, |
636 bool using_oauth, | 636 bool using_oauth, |
637 bool has_cookies, | 637 bool has_cookies, |
638 LoginUtils::Delegate* delegate) { | 638 LoginUtils::Delegate* delegate) { |
639 BootTimesLoader* btl = BootTimesLoader::Get(); | 639 BootTimesLoader* btl = BootTimesLoader::Get(); |
640 | 640 |
641 VLOG(1) << "Completing login for " << username; | 641 VLOG(1) << "Completing login for " << username; |
642 | 642 |
643 if (CrosLibrary::Get()->EnsureLoaded()) { | 643 if (CrosLibrary::Get()->libcros_loaded()) { |
satorux1
2011/11/16 23:51:34
IsRunningOnChrome() instead, or remove it?
The co
stevenjb
2011/11/17 00:23:33
I'm not sure what might break with login / tests i
| |
644 btl->AddLoginTimeMarker("StartSession-Start", false); | 644 btl->AddLoginTimeMarker("StartSession-Start", false); |
645 DBusThreadManager::Get()->GetSessionManagerClient()->StartSession( | 645 DBusThreadManager::Get()->GetSessionManagerClient()->StartSession( |
646 username); | 646 username); |
647 btl->AddLoginTimeMarker("StartSession-End", false); | 647 btl->AddLoginTimeMarker("StartSession-End", false); |
648 } | 648 } |
649 | 649 |
650 btl->AddLoginTimeMarker("UserLoggedIn-Start", false); | 650 btl->AddLoginTimeMarker("UserLoggedIn-Start", false); |
651 UserManager::Get()->UserLoggedIn(username); | 651 UserManager::Get()->UserLoggedIn(username); |
652 btl->AddLoginTimeMarker("UserLoggedIn-End", false); | 652 btl->AddLoginTimeMarker("UserLoggedIn-End", false); |
653 | 653 |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
798 // Supply credentials for sync and others to use. Load tokens from disk. | 798 // Supply credentials for sync and others to use. Load tokens from disk. |
799 if (!using_oauth_) { | 799 if (!using_oauth_) { |
800 // For existing users there's usually a pending online auth request. | 800 // For existing users there's usually a pending online auth request. |
801 // Tokens will be fetched after it's is succeeded. | 801 // Tokens will be fetched after it's is succeeded. |
802 if (!pending_requests_) | 802 if (!pending_requests_) |
803 StartSync(user_profile, credentials_); | 803 StartSync(user_profile, credentials_); |
804 } | 804 } |
805 | 805 |
806 // Own TPM device if, for any reason, it has not been done in EULA | 806 // Own TPM device if, for any reason, it has not been done in EULA |
807 // wizard screen. | 807 // wizard screen. |
808 if (CrosLibrary::Get()->EnsureLoaded()) { | 808 if (CrosLibrary::Get()->libcros_loaded()) { |
satorux1
2011/11/16 23:51:34
ditto.
stevenjb
2011/11/17 00:23:33
ditto.
| |
809 CryptohomeLibrary* cryptohome = CrosLibrary::Get()->GetCryptohomeLibrary(); | 809 CryptohomeLibrary* cryptohome = CrosLibrary::Get()->GetCryptohomeLibrary(); |
810 btl->AddLoginTimeMarker("TPMOwn-Start", false); | 810 btl->AddLoginTimeMarker("TPMOwn-Start", false); |
811 if (cryptohome->TpmIsEnabled() && !cryptohome->TpmIsBeingOwned()) { | 811 if (cryptohome->TpmIsEnabled() && !cryptohome->TpmIsBeingOwned()) { |
812 if (cryptohome->TpmIsOwned()) { | 812 if (cryptohome->TpmIsOwned()) { |
813 cryptohome->TpmClearStoredPassword(); | 813 cryptohome->TpmClearStoredPassword(); |
814 } else { | 814 } else { |
815 cryptohome->TpmCanAttemptOwnership(); | 815 cryptohome->TpmCanAttemptOwnership(); |
816 } | 816 } |
817 } | 817 } |
818 btl->AddLoginTimeMarker("TPMOwn-End", false); | 818 btl->AddLoginTimeMarker("TPMOwn-End", false); |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
916 // that input method preferences are synced, so users can use their | 916 // that input method preferences are synced, so users can use their |
917 // farovite input methods as soon as the preferences are synced. | 917 // farovite input methods as soon as the preferences are synced. |
918 LanguageSwitchMenu::SwitchLanguage(pref_locale); | 918 LanguageSwitchMenu::SwitchLanguage(pref_locale); |
919 } | 919 } |
920 | 920 |
921 void LoginUtilsImpl::CompleteOffTheRecordLogin(const GURL& start_url) { | 921 void LoginUtilsImpl::CompleteOffTheRecordLogin(const GURL& start_url) { |
922 VLOG(1) << "Completing incognito login"; | 922 VLOG(1) << "Completing incognito login"; |
923 | 923 |
924 UserManager::Get()->GuestUserLoggedIn(); | 924 UserManager::Get()->GuestUserLoggedIn(); |
925 | 925 |
926 if (CrosLibrary::Get()->EnsureLoaded()) { | 926 if (CrosLibrary::Get()->libcros_loaded()) { |
927 // Session Manager may kill the chrome anytime after this point. | 927 // Session Manager may kill the chrome anytime after this point. |
928 // Write exit_cleanly and other stuff to the disk here. | 928 // Write exit_cleanly and other stuff to the disk here. |
929 g_browser_process->EndSession(); | 929 g_browser_process->EndSession(); |
930 | 930 |
931 // For guest session we ask session manager to restart Chrome with --bwsi | 931 // For guest session we ask session manager to restart Chrome with --bwsi |
932 // flag. We keep only some of the arguments of this process. | 932 // flag. We keep only some of the arguments of this process. |
933 const CommandLine& browser_command_line = *CommandLine::ForCurrentProcess(); | 933 const CommandLine& browser_command_line = *CommandLine::ForCurrentProcess(); |
934 CommandLine command_line(browser_command_line.GetProgram()); | 934 CommandLine command_line(browser_command_line.GetProgram()); |
935 std::string cmd_line_str = | 935 std::string cmd_line_str = |
936 GetOffTheRecordCommandLine(start_url, | 936 GetOffTheRecordCommandLine(start_url, |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1091 GURL(GaiaUrls::GetInstance()->client_login_url()), | 1091 GURL(GaiaUrls::GetInstance()->client_login_url()), |
1092 chrome_browser_net::UrlInfo::EARLY_LOAD_MOTIVATED, | 1092 chrome_browser_net::UrlInfo::EARLY_LOAD_MOTIVATED, |
1093 kConnectionsNeeded); | 1093 kConnectionsNeeded); |
1094 netlib->RemoveNetworkManagerObserver(this); | 1094 netlib->RemoveNetworkManagerObserver(this); |
1095 delete this; | 1095 delete this; |
1096 } | 1096 } |
1097 } | 1097 } |
1098 }; | 1098 }; |
1099 | 1099 |
1100 void LoginUtilsImpl::PrewarmAuthentication() { | 1100 void LoginUtilsImpl::PrewarmAuthentication() { |
1101 if (CrosLibrary::Get()->EnsureLoaded()) { | 1101 if (CrosLibrary::Get()->libcros_loaded()) { |
1102 NetworkLibrary *network = CrosLibrary::Get()->GetNetworkLibrary(); | 1102 NetworkLibrary *network = CrosLibrary::Get()->GetNetworkLibrary(); |
1103 if (network->Connected()) { | 1103 if (network->Connected()) { |
1104 const int kConnectionsNeeded = 1; | 1104 const int kConnectionsNeeded = 1; |
1105 chrome_browser_net::PreconnectOnUIThread( | 1105 chrome_browser_net::PreconnectOnUIThread( |
1106 GURL(GaiaUrls::GetInstance()->client_login_url()), | 1106 GURL(GaiaUrls::GetInstance()->client_login_url()), |
1107 chrome_browser_net::UrlInfo::EARLY_LOAD_MOTIVATED, | 1107 chrome_browser_net::UrlInfo::EARLY_LOAD_MOTIVATED, |
1108 kConnectionsNeeded); | 1108 kConnectionsNeeded); |
1109 } else { | 1109 } else { |
1110 new WarmingObserver(); | 1110 new WarmingObserver(); |
1111 } | 1111 } |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1314 // Mark login host for deletion after browser starts. This | 1314 // Mark login host for deletion after browser starts. This |
1315 // guarantees that the message loop will be referenced by the | 1315 // guarantees that the message loop will be referenced by the |
1316 // browser before it is dereferenced by the login host. | 1316 // browser before it is dereferenced by the login host. |
1317 if (login_host) { | 1317 if (login_host) { |
1318 login_host->OnSessionStart(); | 1318 login_host->OnSessionStart(); |
1319 login_host = NULL; | 1319 login_host = NULL; |
1320 } | 1320 } |
1321 } | 1321 } |
1322 | 1322 |
1323 } // namespace chromeos | 1323 } // namespace chromeos |
OLD | NEW |