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

Side by Side Diff: chrome/browser/signin/account_tracker_service_factory.cc

Issue 1245103005: Componentize more signin code (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 5 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
OLDNEW
1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2014 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/signin/account_tracker_service_factory.h" 5 #include "chrome/browser/signin/account_tracker_service_factory.h"
6 6
7 #include "base/memory/scoped_ptr.h" 7 #include "base/memory/scoped_ptr.h"
8 #include "chrome/browser/profiles/profile.h" 8 #include "chrome/browser/profiles/profile.h"
9 #include "chrome/browser/signin/chrome_signin_client_factory.h" 9 #include "chrome/browser/signin/chrome_signin_client_factory.h"
10 #include "components/keyed_service/content/browser_context_dependency_manager.h" 10 #include "components/keyed_service/content/browser_context_dependency_manager.h"
11 #include "components/pref_registry/pref_registry_syncable.h"
12 #include "components/signin/core/browser/account_tracker_service.h" 11 #include "components/signin/core/browser/account_tracker_service.h"
13 #include "components/signin/core/common/signin_pref_names.h"
14 12
15 AccountTrackerServiceFactory::AccountTrackerServiceFactory() 13 AccountTrackerServiceFactory::AccountTrackerServiceFactory()
16 : BrowserContextKeyedServiceFactory( 14 : BrowserContextKeyedServiceFactory(
17 "AccountTrackerServiceFactory", 15 "AccountTrackerServiceFactory",
18 BrowserContextDependencyManager::GetInstance()) { 16 BrowserContextDependencyManager::GetInstance()) {
19 DependsOn(ChromeSigninClientFactory::GetInstance()); 17 DependsOn(ChromeSigninClientFactory::GetInstance());
20 } 18 }
21 19
22 AccountTrackerServiceFactory::~AccountTrackerServiceFactory() { 20 AccountTrackerServiceFactory::~AccountTrackerServiceFactory() {
23 } 21 }
24 22
25 // static 23 // static
26 AccountTrackerService* 24 AccountTrackerService*
27 AccountTrackerServiceFactory::GetForProfile(Profile* profile) { 25 AccountTrackerServiceFactory::GetForProfile(Profile* profile) {
28 return static_cast<AccountTrackerService*>( 26 return static_cast<AccountTrackerService*>(
29 GetInstance()->GetServiceForBrowserContext(profile, true)); 27 GetInstance()->GetServiceForBrowserContext(profile, true));
30 } 28 }
31 29
32 // static 30 // static
33 AccountTrackerServiceFactory* AccountTrackerServiceFactory::GetInstance() { 31 AccountTrackerServiceFactory* AccountTrackerServiceFactory::GetInstance() {
34 return Singleton<AccountTrackerServiceFactory>::get(); 32 return Singleton<AccountTrackerServiceFactory>::get();
35 } 33 }
36 34
37 void AccountTrackerServiceFactory::RegisterProfilePrefs( 35 void AccountTrackerServiceFactory::RegisterProfilePrefs(
38 user_prefs::PrefRegistrySyncable* registry) { 36 user_prefs::PrefRegistrySyncable* registry) {
39 registry->RegisterListPref(AccountTrackerService::kAccountInfoPref); 37 AccountTrackerService::RegisterPrefs(registry);
40 registry->RegisterIntegerPref(prefs::kAccountIdMigrationState,
41 AccountTrackerService::MIGRATION_NOT_STARTED);
42 } 38 }
43 39
44 KeyedService* AccountTrackerServiceFactory::BuildServiceInstanceFor( 40 KeyedService* AccountTrackerServiceFactory::BuildServiceInstanceFor(
45 content::BrowserContext* context) const { 41 content::BrowserContext* context) const {
46 Profile* profile = static_cast<Profile*>(context); 42 Profile* profile = static_cast<Profile*>(context);
47 AccountTrackerService* service = new AccountTrackerService(); 43 AccountTrackerService* service = new AccountTrackerService();
48 service->Initialize(ChromeSigninClientFactory::GetForProfile(profile)); 44 service->Initialize(ChromeSigninClientFactory::GetForProfile(profile));
49 return service; 45 return service;
50 } 46 }
OLDNEW
« no previous file with comments | « chrome/browser/signin/account_reconcilor_unittest.cc ('k') | chrome/browser/signin/fake_profile_oauth2_token_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698