Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(300)

Side by Side Diff: chrome/browser/chromeos/login/login_utils.cc

Issue 8588006: Eliminate CrosLibrary::EnsureLoaded (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 19 matching lines...) Expand all
30 #include "chrome/browser/chromeos/input_method/input_method_manager.h" 30 #include "chrome/browser/chromeos/input_method/input_method_manager.h"
31 #include "chrome/browser/chromeos/input_method/input_method_util.h" 31 #include "chrome/browser/chromeos/input_method/input_method_util.h"
32 #include "chrome/browser/chromeos/login/background_view.h" 32 #include "chrome/browser/chromeos/login/background_view.h"
33 #include "chrome/browser/chromeos/login/cookie_fetcher.h" 33 #include "chrome/browser/chromeos/login/cookie_fetcher.h"
34 #include "chrome/browser/chromeos/login/language_switch_menu.h" 34 #include "chrome/browser/chromeos/login/language_switch_menu.h"
35 #include "chrome/browser/chromeos/login/login_display_host.h" 35 #include "chrome/browser/chromeos/login/login_display_host.h"
36 #include "chrome/browser/chromeos/login/ownership_service.h" 36 #include "chrome/browser/chromeos/login/ownership_service.h"
37 #include "chrome/browser/chromeos/login/parallel_authenticator.h" 37 #include "chrome/browser/chromeos/login/parallel_authenticator.h"
38 #include "chrome/browser/chromeos/login/screen_locker.h" 38 #include "chrome/browser/chromeos/login/screen_locker.h"
39 #include "chrome/browser/chromeos/login/user_manager.h" 39 #include "chrome/browser/chromeos/login/user_manager.h"
40 #include "chrome/browser/chromeos/system/runtime_environment.h"
40 #include "chrome/browser/extensions/extension_service.h" 41 #include "chrome/browser/extensions/extension_service.h"
41 #include "chrome/browser/first_run/first_run.h" 42 #include "chrome/browser/first_run/first_run.h"
42 #include "chrome/browser/net/chrome_url_request_context.h" 43 #include "chrome/browser/net/chrome_url_request_context.h"
43 #include "chrome/browser/net/gaia/gaia_oauth_consumer.h" 44 #include "chrome/browser/net/gaia/gaia_oauth_consumer.h"
44 #include "chrome/browser/net/gaia/gaia_oauth_fetcher.h" 45 #include "chrome/browser/net/gaia/gaia_oauth_fetcher.h"
45 #include "chrome/browser/net/gaia/token_service.h" 46 #include "chrome/browser/net/gaia/token_service.h"
46 #include "chrome/browser/net/preconnect.h" 47 #include "chrome/browser/net/preconnect.h"
47 #include "chrome/browser/policy/browser_policy_connector.h" 48 #include "chrome/browser/policy/browser_policy_connector.h"
48 #include "chrome/browser/prefs/pref_member.h" 49 #include "chrome/browser/prefs/pref_member.h"
49 #include "chrome/browser/profiles/profile.h" 50 #include "chrome/browser/profiles/profile.h"
(...skipping 583 matching lines...) Expand 10 before | Expand all | Expand 10 after
633 const std::string& password, 634 const std::string& password,
634 const GaiaAuthConsumer::ClientLoginResult& credentials, 635 const GaiaAuthConsumer::ClientLoginResult& credentials,
635 bool pending_requests, 636 bool pending_requests,
636 bool using_oauth, 637 bool using_oauth,
637 bool has_cookies, 638 bool has_cookies,
638 LoginUtils::Delegate* delegate) { 639 LoginUtils::Delegate* delegate) {
639 BootTimesLoader* btl = BootTimesLoader::Get(); 640 BootTimesLoader* btl = BootTimesLoader::Get();
640 641
641 VLOG(1) << "Completing login for " << username; 642 VLOG(1) << "Completing login for " << username;
642 643
643 if (CrosLibrary::Get()->EnsureLoaded()) { 644 if (system::runtime_environment::IsRunningOnChromeOS()) {
644 btl->AddLoginTimeMarker("StartSession-Start", false); 645 btl->AddLoginTimeMarker("StartSession-Start", false);
645 DBusThreadManager::Get()->GetSessionManagerClient()->StartSession( 646 DBusThreadManager::Get()->GetSessionManagerClient()->StartSession(
646 username); 647 username);
647 btl->AddLoginTimeMarker("StartSession-End", false); 648 btl->AddLoginTimeMarker("StartSession-End", false);
648 } 649 }
649 650
650 btl->AddLoginTimeMarker("UserLoggedIn-Start", false); 651 btl->AddLoginTimeMarker("UserLoggedIn-Start", false);
651 UserManager::Get()->UserLoggedIn(username); 652 UserManager::Get()->UserLoggedIn(username);
652 btl->AddLoginTimeMarker("UserLoggedIn-End", false); 653 btl->AddLoginTimeMarker("UserLoggedIn-End", false);
653 654
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
798 // Supply credentials for sync and others to use. Load tokens from disk. 799 // Supply credentials for sync and others to use. Load tokens from disk.
799 if (!using_oauth_) { 800 if (!using_oauth_) {
800 // For existing users there's usually a pending online auth request. 801 // For existing users there's usually a pending online auth request.
801 // Tokens will be fetched after it's is succeeded. 802 // Tokens will be fetched after it's is succeeded.
802 if (!pending_requests_) 803 if (!pending_requests_)
803 StartSync(user_profile, credentials_); 804 StartSync(user_profile, credentials_);
804 } 805 }
805 806
806 // Own TPM device if, for any reason, it has not been done in EULA 807 // Own TPM device if, for any reason, it has not been done in EULA
807 // wizard screen. 808 // wizard screen.
808 if (CrosLibrary::Get()->EnsureLoaded()) { 809 if (system::runtime_environment::IsRunningOnChromeOS()) {
809 CryptohomeLibrary* cryptohome = CrosLibrary::Get()->GetCryptohomeLibrary(); 810 CryptohomeLibrary* cryptohome = CrosLibrary::Get()->GetCryptohomeLibrary();
810 btl->AddLoginTimeMarker("TPMOwn-Start", false); 811 btl->AddLoginTimeMarker("TPMOwn-Start", false);
811 if (cryptohome->TpmIsEnabled() && !cryptohome->TpmIsBeingOwned()) { 812 if (cryptohome->TpmIsEnabled() && !cryptohome->TpmIsBeingOwned()) {
812 if (cryptohome->TpmIsOwned()) { 813 if (cryptohome->TpmIsOwned()) {
813 cryptohome->TpmClearStoredPassword(); 814 cryptohome->TpmClearStoredPassword();
814 } else { 815 } else {
815 cryptohome->TpmCanAttemptOwnership(); 816 cryptohome->TpmCanAttemptOwnership();
816 } 817 }
817 } 818 }
818 btl->AddLoginTimeMarker("TPMOwn-End", false); 819 btl->AddLoginTimeMarker("TPMOwn-End", false);
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
916 // that input method preferences are synced, so users can use their 917 // that input method preferences are synced, so users can use their
917 // farovite input methods as soon as the preferences are synced. 918 // farovite input methods as soon as the preferences are synced.
918 LanguageSwitchMenu::SwitchLanguage(pref_locale); 919 LanguageSwitchMenu::SwitchLanguage(pref_locale);
919 } 920 }
920 921
921 void LoginUtilsImpl::CompleteOffTheRecordLogin(const GURL& start_url) { 922 void LoginUtilsImpl::CompleteOffTheRecordLogin(const GURL& start_url) {
922 VLOG(1) << "Completing incognito login"; 923 VLOG(1) << "Completing incognito login";
923 924
924 UserManager::Get()->GuestUserLoggedIn(); 925 UserManager::Get()->GuestUserLoggedIn();
925 926
926 if (CrosLibrary::Get()->EnsureLoaded()) { 927 if (system::runtime_environment::IsRunningOnChromeOS()) {
927 // Session Manager may kill the chrome anytime after this point. 928 // Session Manager may kill the chrome anytime after this point.
928 // Write exit_cleanly and other stuff to the disk here. 929 // Write exit_cleanly and other stuff to the disk here.
929 g_browser_process->EndSession(); 930 g_browser_process->EndSession();
930 931
931 // For guest session we ask session manager to restart Chrome with --bwsi 932 // For guest session we ask session manager to restart Chrome with --bwsi
932 // flag. We keep only some of the arguments of this process. 933 // flag. We keep only some of the arguments of this process.
933 const CommandLine& browser_command_line = *CommandLine::ForCurrentProcess(); 934 const CommandLine& browser_command_line = *CommandLine::ForCurrentProcess();
934 CommandLine command_line(browser_command_line.GetProgram()); 935 CommandLine command_line(browser_command_line.GetProgram());
935 std::string cmd_line_str = 936 std::string cmd_line_str =
936 GetOffTheRecordCommandLine(start_url, 937 GetOffTheRecordCommandLine(start_url,
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
1091 GURL(GaiaUrls::GetInstance()->client_login_url()), 1092 GURL(GaiaUrls::GetInstance()->client_login_url()),
1092 chrome_browser_net::UrlInfo::EARLY_LOAD_MOTIVATED, 1093 chrome_browser_net::UrlInfo::EARLY_LOAD_MOTIVATED,
1093 kConnectionsNeeded); 1094 kConnectionsNeeded);
1094 netlib->RemoveNetworkManagerObserver(this); 1095 netlib->RemoveNetworkManagerObserver(this);
1095 delete this; 1096 delete this;
1096 } 1097 }
1097 } 1098 }
1098 }; 1099 };
1099 1100
1100 void LoginUtilsImpl::PrewarmAuthentication() { 1101 void LoginUtilsImpl::PrewarmAuthentication() {
1101 if (CrosLibrary::Get()->EnsureLoaded()) { 1102 if (system::runtime_environment::IsRunningOnChromeOS()) {
1102 NetworkLibrary *network = CrosLibrary::Get()->GetNetworkLibrary(); 1103 NetworkLibrary *network = CrosLibrary::Get()->GetNetworkLibrary();
1103 if (network->Connected()) { 1104 if (network->Connected()) {
1104 const int kConnectionsNeeded = 1; 1105 const int kConnectionsNeeded = 1;
1105 chrome_browser_net::PreconnectOnUIThread( 1106 chrome_browser_net::PreconnectOnUIThread(
1106 GURL(GaiaUrls::GetInstance()->client_login_url()), 1107 GURL(GaiaUrls::GetInstance()->client_login_url()),
1107 chrome_browser_net::UrlInfo::EARLY_LOAD_MOTIVATED, 1108 chrome_browser_net::UrlInfo::EARLY_LOAD_MOTIVATED,
1108 kConnectionsNeeded); 1109 kConnectionsNeeded);
1109 } else { 1110 } else {
1110 new WarmingObserver(); 1111 new WarmingObserver();
1111 } 1112 }
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
1314 // Mark login host for deletion after browser starts. This 1315 // Mark login host for deletion after browser starts. This
1315 // guarantees that the message loop will be referenced by the 1316 // guarantees that the message loop will be referenced by the
1316 // browser before it is dereferenced by the login host. 1317 // browser before it is dereferenced by the login host.
1317 if (login_host) { 1318 if (login_host) {
1318 login_host->OnSessionStart(); 1319 login_host->OnSessionStart();
1319 login_host = NULL; 1320 login_host = NULL;
1320 } 1321 }
1321 } 1322 }
1322 1323
1323 } // namespace chromeos 1324 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/existing_user_controller.cc ('k') | chrome/browser/chromeos/login/network_screen.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698