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