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

Side by Side Diff: chrome/browser/sync/profile_sync_service_factory.cc

Issue 15517005: Remove references to Profile from browser_context_keyed_service. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 7 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/sync/profile_sync_service_factory.h" 5 #include "chrome/browser/sync/profile_sync_service_factory.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/memory/singleton.h" 8 #include "base/memory/singleton.h"
9 #include "base/prefs/pref_service.h" 9 #include "base/prefs/pref_service.h"
10 #include "chrome/browser/autofill/personal_data_manager_factory.h" 10 #include "chrome/browser/autofill/personal_data_manager_factory.h"
(...skipping 26 matching lines...) Expand all
37 ProfileSyncService* ProfileSyncServiceFactory::GetForProfile( 37 ProfileSyncService* ProfileSyncServiceFactory::GetForProfile(
38 Profile* profile) { 38 Profile* profile) {
39 if (!ProfileSyncService::IsSyncEnabled()) 39 if (!ProfileSyncService::IsSyncEnabled())
40 return NULL; 40 return NULL;
41 41
42 // Do not start sync on the import process. 42 // Do not start sync on the import process.
43 if (ProfileManager::IsImportProcess(*CommandLine::ForCurrentProcess())) 43 if (ProfileManager::IsImportProcess(*CommandLine::ForCurrentProcess()))
44 return NULL; 44 return NULL;
45 45
46 return static_cast<ProfileSyncService*>( 46 return static_cast<ProfileSyncService*>(
47 GetInstance()->GetServiceForProfile(profile, true)); 47 GetInstance()->GetServiceForBrowserContext(profile, true));
48 } 48 }
49 49
50 ProfileSyncServiceFactory::ProfileSyncServiceFactory() 50 ProfileSyncServiceFactory::ProfileSyncServiceFactory()
51 : ProfileKeyedServiceFactory("ProfileSyncService", 51 : BrowserContextKeyedServiceFactory("ProfileSyncService",
52 ProfileDependencyManager::GetInstance()) { 52 BrowserContextDependencyManager::GetInstance()) {
53 53
54 // The ProfileSyncService depends on various SyncableServices being around 54 // The ProfileSyncService depends on various SyncableServices being around
55 // when it is shut down. Specify those dependencies here to build the proper 55 // when it is shut down. Specify those dependencies here to build the proper
56 // destruction order. 56 // destruction order.
57 DependsOn(TemplateURLServiceFactory::GetInstance()); 57 DependsOn(TemplateURLServiceFactory::GetInstance());
58 DependsOn(autofill::PersonalDataManagerFactory::GetInstance()); 58 DependsOn(autofill::PersonalDataManagerFactory::GetInstance());
59 #if defined(ENABLE_THEMES) 59 #if defined(ENABLE_THEMES)
60 DependsOn(ThemeServiceFactory::GetInstance()); 60 DependsOn(ThemeServiceFactory::GetInstance());
61 #endif 61 #endif
62 DependsOn(GlobalErrorServiceFactory::GetInstance()); 62 DependsOn(GlobalErrorServiceFactory::GetInstance());
63 DependsOn(SigninManagerFactory::GetInstance()); 63 DependsOn(SigninManagerFactory::GetInstance());
64 DependsOn(PasswordStoreFactory::GetInstance()); 64 DependsOn(PasswordStoreFactory::GetInstance());
65 DependsOn(extensions::ExtensionSystemFactory::GetInstance()); 65 DependsOn(extensions::ExtensionSystemFactory::GetInstance());
66 DependsOn(WebDataServiceFactory::GetInstance()); 66 DependsOn(WebDataServiceFactory::GetInstance());
67 DependsOn(HistoryServiceFactory::GetInstance()); 67 DependsOn(HistoryServiceFactory::GetInstance());
68 DependsOn(BookmarkModelFactory::GetInstance()); 68 DependsOn(BookmarkModelFactory::GetInstance());
69 DependsOn(AboutSigninInternalsFactory::GetInstance()); 69 DependsOn(AboutSigninInternalsFactory::GetInstance());
70 70
71 // The following have not been converted to ProfileKeyedServices yet, and for 71 // The following have not been converted to BrowserContextKeyedServices yet, a nd for
72 // now they are explicitly destroyed after the ProfileDependencyManager is 72 // now they are explicitly destroyed after the BrowserContextDependencyManager is
73 // told to DestroyProfileServices, so they will be around when the 73 // told to DestroyProfileServices, so they will be around when the
74 // ProfileSyncService is destroyed. 74 // ProfileSyncService is destroyed.
75 75
76 // DependsOn(FaviconServiceFactory::GetInstance()); 76 // DependsOn(FaviconServiceFactory::GetInstance());
77 } 77 }
78 78
79 ProfileSyncServiceFactory::~ProfileSyncServiceFactory() { 79 ProfileSyncServiceFactory::~ProfileSyncServiceFactory() {
80 } 80 }
81 81
82 ProfileKeyedService* ProfileSyncServiceFactory::BuildServiceInstanceFor( 82 BrowserContextKeyedService* ProfileSyncServiceFactory::BuildServiceInstanceFor(
83 content::BrowserContext* context) const { 83 content::BrowserContext* context) const {
84 Profile* profile = static_cast<Profile*>(context); 84 Profile* profile = static_cast<Profile*>(context);
85 85
86 ProfileSyncService::StartBehavior behavior = 86 ProfileSyncService::StartBehavior behavior =
87 browser_defaults::kSyncAutoStarts ? ProfileSyncService::AUTO_START 87 browser_defaults::kSyncAutoStarts ? ProfileSyncService::AUTO_START
88 : ProfileSyncService::MANUAL_START; 88 : ProfileSyncService::MANUAL_START;
89 89
90 SigninManagerBase* signin = SigninManagerFactory::GetForProfile(profile); 90 SigninManagerBase* signin = SigninManagerFactory::GetForProfile(profile);
91 91
92 // TODO(atwilson): Change AboutSigninInternalsFactory to load on startup 92 // TODO(atwilson): Change AboutSigninInternalsFactory to load on startup
(...skipping 13 matching lines...) Expand all
106 signin, 106 signin,
107 behavior); 107 behavior);
108 108
109 pss->factory()->RegisterDataTypes(pss); 109 pss->factory()->RegisterDataTypes(pss);
110 pss->Initialize(); 110 pss->Initialize();
111 return pss; 111 return pss;
112 } 112 }
113 113
114 // static 114 // static
115 bool ProfileSyncServiceFactory::HasProfileSyncService(Profile* profile) { 115 bool ProfileSyncServiceFactory::HasProfileSyncService(Profile* profile) {
116 return GetInstance()->GetServiceForProfile(profile, false) != NULL; 116 return GetInstance()->GetServiceForBrowserContext(profile, false) != NULL;
117 } 117 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698