OLD | NEW |
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 "chrome/browser/defaults.h" | 9 #include "chrome/browser/defaults.h" |
10 #include "chrome/browser/autofill/personal_data_manager_factory.h" | 10 #include "chrome/browser/autofill/personal_data_manager_factory.h" |
11 #include "chrome/browser/extensions/extension_system_factory.h" | |
12 #include "chrome/browser/prefs/pref_service.h" | 11 #include "chrome/browser/prefs/pref_service.h" |
13 #include "chrome/browser/profiles/profile.h" | 12 #include "chrome/browser/profiles/profile.h" |
14 #include "chrome/browser/profiles/profile_dependency_manager.h" | 13 #include "chrome/browser/profiles/profile_dependency_manager.h" |
15 #include "chrome/browser/search_engines/template_url_service_factory.h" | 14 #include "chrome/browser/search_engines/template_url_service_factory.h" |
16 #include "chrome/browser/sessions/tab_restore_service_factory.h" | 15 #include "chrome/browser/sessions/tab_restore_service_factory.h" |
17 #include "chrome/browser/signin/signin_manager.h" | 16 #include "chrome/browser/signin/signin_manager.h" |
18 #include "chrome/browser/signin/signin_manager_factory.h" | 17 #include "chrome/browser/signin/signin_manager_factory.h" |
19 #include "chrome/browser/sync/profile_sync_components_factory_impl.h" | 18 #include "chrome/browser/sync/profile_sync_components_factory_impl.h" |
20 #include "chrome/browser/sync/profile_sync_service.h" | 19 #include "chrome/browser/sync/profile_sync_service.h" |
21 #include "chrome/browser/themes/theme_service_factory.h" | 20 #include "chrome/browser/themes/theme_service_factory.h" |
(...skipping 20 matching lines...) Expand all Loading... |
42 ProfileDependencyManager::GetInstance()) { | 41 ProfileDependencyManager::GetInstance()) { |
43 | 42 |
44 // The ProfileSyncService depends on various SyncableServices being around | 43 // The ProfileSyncService depends on various SyncableServices being around |
45 // when it is shut down. Specify those dependencies here to build the proper | 44 // when it is shut down. Specify those dependencies here to build the proper |
46 // destruction order. | 45 // destruction order. |
47 DependsOn(TemplateURLServiceFactory::GetInstance()); | 46 DependsOn(TemplateURLServiceFactory::GetInstance()); |
48 DependsOn(PersonalDataManagerFactory::GetInstance()); | 47 DependsOn(PersonalDataManagerFactory::GetInstance()); |
49 DependsOn(ThemeServiceFactory::GetInstance()); | 48 DependsOn(ThemeServiceFactory::GetInstance()); |
50 DependsOn(GlobalErrorServiceFactory::GetInstance()); | 49 DependsOn(GlobalErrorServiceFactory::GetInstance()); |
51 DependsOn(SigninManagerFactory::GetInstance()); | 50 DependsOn(SigninManagerFactory::GetInstance()); |
52 DependsOn(ExtensionSystemFactory::GetInstance()); | |
53 | 51 |
54 // The following have not been converted to ProfileKeyedServices yet, and for | 52 // The following have not been converted to ProfileKeyedServices yet, and for |
55 // now they are explicitly destroyed after the ProfileDependencyManager is | 53 // now they are explicitly destroyed after the ProfileDependencyManager is |
56 // told to DestroyProfileServices, so they will be around when the | 54 // told to DestroyProfileServices, so they will be around when the |
57 // ProfileSyncService is destroyed. | 55 // ProfileSyncService is destroyed. |
58 | 56 |
59 // DependsOn(WebDataServiceFactory::GetInstance()); | 57 // DependsOn(WebDataServiceFactory::GetInstance()); |
60 // DependsOn(HistoryServiceFactory::GetInstance()); | 58 // DependsOn(HistoryServiceFactory::GetInstance()); |
61 // DependsOn(BookmarkBarModelFactory::GetInstance()); | 59 // DependsOn(BookmarkBarModelFactory::GetInstance()); |
62 // DependsOn(FaviconServiceFactory::GetInstance()); | 60 // DependsOn(FaviconServiceFactory::GetInstance()); |
63 // DependsOn(PasswordStoreService::GetInstance()); | 61 // DependsOn(PasswordStoreService::GetInstance()); |
| 62 // DependsOn(ExtensionServiceFactory::GetInstance()); |
64 } | 63 } |
65 | 64 |
66 ProfileSyncServiceFactory::~ProfileSyncServiceFactory() { | 65 ProfileSyncServiceFactory::~ProfileSyncServiceFactory() { |
67 } | 66 } |
68 | 67 |
69 ProfileKeyedService* ProfileSyncServiceFactory::BuildServiceInstanceFor( | 68 ProfileKeyedService* ProfileSyncServiceFactory::BuildServiceInstanceFor( |
70 Profile* profile) const { | 69 Profile* profile) const { |
71 ProfileSyncService::StartBehavior behavior = | 70 ProfileSyncService::StartBehavior behavior = |
72 browser_defaults::kSyncAutoStarts ? ProfileSyncService::AUTO_START | 71 browser_defaults::kSyncAutoStarts ? ProfileSyncService::AUTO_START |
73 : ProfileSyncService::MANUAL_START; | 72 : ProfileSyncService::MANUAL_START; |
(...skipping 15 matching lines...) Expand all Loading... |
89 | 88 |
90 pss->factory()->RegisterDataTypes(pss); | 89 pss->factory()->RegisterDataTypes(pss); |
91 pss->Initialize(); | 90 pss->Initialize(); |
92 return pss; | 91 return pss; |
93 } | 92 } |
94 | 93 |
95 // static | 94 // static |
96 bool ProfileSyncServiceFactory::HasProfileSyncService(Profile* profile) { | 95 bool ProfileSyncServiceFactory::HasProfileSyncService(Profile* profile) { |
97 return GetInstance()->GetServiceForProfile(profile, false) != NULL; | 96 return GetInstance()->GetServiceForProfile(profile, false) != NULL; |
98 } | 97 } |
OLD | NEW |