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