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

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

Issue 9169096: Remove a bunch of GetProfileSyncService callers to use the new factory. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rm todos Created 8 years, 10 months 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 #include "chrome/browser/net/gaia/gaia_oauth_fetcher.h" 47 #include "chrome/browser/net/gaia/gaia_oauth_fetcher.h"
48 #include "chrome/browser/net/preconnect.h" 48 #include "chrome/browser/net/preconnect.h"
49 #include "chrome/browser/policy/browser_policy_connector.h" 49 #include "chrome/browser/policy/browser_policy_connector.h"
50 #include "chrome/browser/prefs/pref_member.h" 50 #include "chrome/browser/prefs/pref_member.h"
51 #include "chrome/browser/profiles/profile.h" 51 #include "chrome/browser/profiles/profile.h"
52 #include "chrome/browser/profiles/profile_manager.h" 52 #include "chrome/browser/profiles/profile_manager.h"
53 #include "chrome/browser/signin/signin_manager.h" 53 #include "chrome/browser/signin/signin_manager.h"
54 #include "chrome/browser/signin/signin_manager_factory.h" 54 #include "chrome/browser/signin/signin_manager_factory.h"
55 #include "chrome/browser/signin/token_service.h" 55 #include "chrome/browser/signin/token_service.h"
56 #include "chrome/browser/sync/profile_sync_service.h" 56 #include "chrome/browser/sync/profile_sync_service.h"
57 #include "chrome/browser/sync/profile_sync_service_factory.h"
57 #include "chrome/browser/ui/browser_init.h" 58 #include "chrome/browser/ui/browser_init.h"
58 #include "chrome/common/chrome_paths.h" 59 #include "chrome/common/chrome_paths.h"
59 #include "chrome/common/chrome_switches.h" 60 #include "chrome/common/chrome_switches.h"
60 #include "chrome/common/logging_chrome.h" 61 #include "chrome/common/logging_chrome.h"
61 #include "chrome/common/net/gaia/gaia_auth_consumer.h" 62 #include "chrome/common/net/gaia/gaia_auth_consumer.h"
62 #include "chrome/common/net/gaia/gaia_auth_fetcher.h" 63 #include "chrome/common/net/gaia/gaia_auth_fetcher.h"
63 #include "chrome/common/net/gaia/gaia_constants.h" 64 #include "chrome/common/net/gaia/gaia_constants.h"
64 #include "chrome/common/net/gaia/gaia_urls.h" 65 #include "chrome/common/net/gaia/gaia_urls.h"
65 #include "chrome/common/pref_names.h" 66 #include "chrome/common/pref_names.h"
66 #include "chrome/common/url_constants.h" 67 #include "chrome/common/url_constants.h"
(...skipping 836 matching lines...) Expand 10 before | Expand all | Expand 10 after
903 // Make sure SigninManager is connected to our current user (this should 904 // Make sure SigninManager is connected to our current user (this should
904 // happen automatically because we set kGoogleServicesUsername in 905 // happen automatically because we set kGoogleServicesUsername in
905 // OnProfileCreated()). 906 // OnProfileCreated()).
906 DCHECK_EQ(UserManager::Get()->logged_in_user().display_email(), 907 DCHECK_EQ(UserManager::Get()->logged_in_user().display_email(),
907 signin->GetAuthenticatedUsername()); 908 signin->GetAuthenticatedUsername());
908 static bool initialized = false; 909 static bool initialized = false;
909 if (!initialized) { 910 if (!initialized) {
910 initialized = true; 911 initialized = true;
911 // Pass the updated passphrase to the sync service for use in decrypting 912 // Pass the updated passphrase to the sync service for use in decrypting
912 // data encrypted with the user's GAIA password. 913 // data encrypted with the user's GAIA password.
913 ProfileSyncService* sync_service = user_profile->GetProfileSyncService(); 914 ProfileSyncService* sync_service =
915 ProfileSyncServiceFactory::GetInstance()->GetForProfile(user_profile);
914 if (sync_service) 916 if (sync_service)
915 sync_service->SetPassphrase(password_, false); 917 sync_service->SetPassphrase(password_, false);
916 } 918 }
917 password_.clear(); 919 password_.clear();
918 TokenService* token_service = user_profile->GetTokenService(); 920 TokenService* token_service = user_profile->GetTokenService();
919 token_service->UpdateCredentials(credentials); 921 token_service->UpdateCredentials(credentials);
920 if (token_service->AreCredentialsValid()) 922 if (token_service->AreCredentialsValid())
921 token_service->StartFetchingTokens(); 923 token_service->StartFetchingTokens();
922 } 924 }
923 925
(...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after
1364 bool LoginUtils::IsWhitelisted(const std::string& username) { 1366 bool LoginUtils::IsWhitelisted(const std::string& username) {
1365 CrosSettings* cros_settings = CrosSettings::Get(); 1367 CrosSettings* cros_settings = CrosSettings::Get();
1366 bool allow_new_user = false; 1368 bool allow_new_user = false;
1367 cros_settings->GetBoolean(kAccountsPrefAllowNewUser, &allow_new_user); 1369 cros_settings->GetBoolean(kAccountsPrefAllowNewUser, &allow_new_user);
1368 if (allow_new_user) 1370 if (allow_new_user)
1369 return true; 1371 return true;
1370 return cros_settings->FindEmailInList(kAccountsPrefUsers, username); 1372 return cros_settings->FindEmailInList(kAccountsPrefUsers, username);
1371 } 1373 }
1372 1374
1373 } // namespace chromeos 1375 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/automation/testing_automation_provider.cc ('k') | chrome/browser/chromeos/login/screen_locker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698