| 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/extensions/extension_system_factory.h" |
| 12 #include "chrome/browser/prefs/pref_service.h" | 12 #include "chrome/browser/prefs/pref_service.h" |
| 13 #include "chrome/browser/profiles/profile.h" | 13 #include "chrome/browser/profiles/profile.h" |
| 14 #include "chrome/browser/profiles/profile_dependency_manager.h" | 14 #include "chrome/browser/profiles/profile_dependency_manager.h" |
| 15 #include "chrome/browser/password_manager/password_store_factory.h" | 15 #include "chrome/browser/password_manager/password_store_factory.h" |
| 16 #include "chrome/browser/search_engines/template_url_service_factory.h" | 16 #include "chrome/browser/search_engines/template_url_service_factory.h" |
| 17 #include "chrome/browser/sessions/tab_restore_service_factory.h" | 17 #include "chrome/browser/sessions/tab_restore_service_factory.h" |
| 18 #include "chrome/browser/signin/signin_manager.h" | 18 #include "chrome/browser/signin/signin_manager.h" |
| 19 #include "chrome/browser/signin/signin_manager_factory.h" | 19 #include "chrome/browser/signin/signin_manager_factory.h" |
| 20 #include "chrome/browser/sync/profile_sync_components_factory_impl.h" | 20 #include "chrome/browser/sync/profile_sync_components_factory_impl.h" |
| 21 #include "chrome/browser/sync/profile_sync_service.h" | 21 #include "chrome/browser/sync/profile_sync_service.h" |
| 22 #include "chrome/browser/themes/theme_service_factory.h" | 22 #include "chrome/browser/themes/theme_service_factory.h" |
| 23 #include "chrome/browser/ui/global_error_service_factory.h" | 23 #include "chrome/browser/ui/global_error_service_factory.h" |
| 24 #include "chrome/browser/webdata/web_data_service_factory.h" |
| 24 #include "chrome/common/pref_names.h" | 25 #include "chrome/common/pref_names.h" |
| 25 | 26 |
| 26 // static | 27 // static |
| 27 ProfileSyncServiceFactory* ProfileSyncServiceFactory::GetInstance() { | 28 ProfileSyncServiceFactory* ProfileSyncServiceFactory::GetInstance() { |
| 28 return Singleton<ProfileSyncServiceFactory>::get(); | 29 return Singleton<ProfileSyncServiceFactory>::get(); |
| 29 } | 30 } |
| 30 | 31 |
| 31 // static | 32 // static |
| 32 ProfileSyncService* ProfileSyncServiceFactory::GetForProfile( | 33 ProfileSyncService* ProfileSyncServiceFactory::GetForProfile( |
| 33 Profile* profile) { | 34 Profile* profile) { |
| (...skipping 13 matching lines...) Expand all Loading... |
| 47 // destruction order. | 48 // destruction order. |
| 48 DependsOn(TemplateURLServiceFactory::GetInstance()); | 49 DependsOn(TemplateURLServiceFactory::GetInstance()); |
| 49 DependsOn(PersonalDataManagerFactory::GetInstance()); | 50 DependsOn(PersonalDataManagerFactory::GetInstance()); |
| 50 #if defined(ENABLE_THEMES) | 51 #if defined(ENABLE_THEMES) |
| 51 DependsOn(ThemeServiceFactory::GetInstance()); | 52 DependsOn(ThemeServiceFactory::GetInstance()); |
| 52 #endif | 53 #endif |
| 53 DependsOn(GlobalErrorServiceFactory::GetInstance()); | 54 DependsOn(GlobalErrorServiceFactory::GetInstance()); |
| 54 DependsOn(SigninManagerFactory::GetInstance()); | 55 DependsOn(SigninManagerFactory::GetInstance()); |
| 55 DependsOn(PasswordStoreFactory::GetInstance()); | 56 DependsOn(PasswordStoreFactory::GetInstance()); |
| 56 DependsOn(ExtensionSystemFactory::GetInstance()); | 57 DependsOn(ExtensionSystemFactory::GetInstance()); |
| 58 DependsOn(WebDataServiceFactory::GetInstance()); |
| 57 | 59 |
| 58 // The following have not been converted to ProfileKeyedServices yet, and for | 60 // The following have not been converted to ProfileKeyedServices yet, and for |
| 59 // now they are explicitly destroyed after the ProfileDependencyManager is | 61 // now they are explicitly destroyed after the ProfileDependencyManager is |
| 60 // told to DestroyProfileServices, so they will be around when the | 62 // told to DestroyProfileServices, so they will be around when the |
| 61 // ProfileSyncService is destroyed. | 63 // ProfileSyncService is destroyed. |
| 62 | 64 |
| 63 // DependsOn(WebDataServiceFactory::GetInstance()); | |
| 64 // DependsOn(HistoryServiceFactory::GetInstance()); | 65 // DependsOn(HistoryServiceFactory::GetInstance()); |
| 65 // DependsOn(BookmarkBarModelFactory::GetInstance()); | 66 // DependsOn(BookmarkBarModelFactory::GetInstance()); |
| 66 // DependsOn(FaviconServiceFactory::GetInstance()); | 67 // DependsOn(FaviconServiceFactory::GetInstance()); |
| 67 } | 68 } |
| 68 | 69 |
| 69 ProfileSyncServiceFactory::~ProfileSyncServiceFactory() { | 70 ProfileSyncServiceFactory::~ProfileSyncServiceFactory() { |
| 70 } | 71 } |
| 71 | 72 |
| 72 ProfileKeyedService* ProfileSyncServiceFactory::BuildServiceInstanceFor( | 73 ProfileKeyedService* ProfileSyncServiceFactory::BuildServiceInstanceFor( |
| 73 Profile* profile) const { | 74 Profile* profile) const { |
| (...skipping 18 matching lines...) Expand all Loading... |
| 92 | 93 |
| 93 pss->factory()->RegisterDataTypes(pss); | 94 pss->factory()->RegisterDataTypes(pss); |
| 94 pss->Initialize(); | 95 pss->Initialize(); |
| 95 return pss; | 96 return pss; |
| 96 } | 97 } |
| 97 | 98 |
| 98 // static | 99 // static |
| 99 bool ProfileSyncServiceFactory::HasProfileSyncService(Profile* profile) { | 100 bool ProfileSyncServiceFactory::HasProfileSyncService(Profile* profile) { |
| 100 return GetInstance()->GetServiceForProfile(profile, false) != NULL; | 101 return GetInstance()->GetServiceForProfile(profile, false) != NULL; |
| 101 } | 102 } |
| OLD | NEW |