| 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 <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
| 10 #include "base/memory/singleton.h" | 10 #include "base/memory/singleton.h" |
| 11 #include "base/metrics/histogram_macros.h" | 11 #include "base/metrics/histogram_macros.h" |
| 12 #include "base/threading/sequenced_worker_pool.h" | 12 #include "base/threading/sequenced_worker_pool.h" |
| 13 #include "base/time/time.h" | 13 #include "base/time/time.h" |
| 14 #include "build/build_config.h" | 14 #include "build/build_config.h" |
| 15 #include "chrome/browser/autofill/personal_data_manager_factory.h" | 15 #include "chrome/browser/autofill/personal_data_manager_factory.h" |
| 16 #include "chrome/browser/bookmarks/bookmark_model_factory.h" | 16 #include "chrome/browser/bookmarks/bookmark_model_factory.h" |
| 17 #include "chrome/browser/browser_process.h" | 17 #include "chrome/browser/browser_process.h" |
| 18 #include "chrome/browser/defaults.h" | 18 #include "chrome/browser/defaults.h" |
| 19 #include "chrome/browser/dom_distiller/dom_distiller_service_factory.h" |
| 19 #include "chrome/browser/gcm/gcm_profile_service_factory.h" | 20 #include "chrome/browser/gcm/gcm_profile_service_factory.h" |
| 20 #include "chrome/browser/history/history_service_factory.h" | 21 #include "chrome/browser/history/history_service_factory.h" |
| 21 #include "chrome/browser/invalidation/profile_invalidation_provider_factory.h" | 22 #include "chrome/browser/invalidation/profile_invalidation_provider_factory.h" |
| 22 #include "chrome/browser/password_manager/password_store_factory.h" | 23 #include "chrome/browser/password_manager/password_store_factory.h" |
| 23 #include "chrome/browser/profiles/profile.h" | 24 #include "chrome/browser/profiles/profile.h" |
| 24 #include "chrome/browser/profiles/profile_manager.h" | 25 #include "chrome/browser/profiles/profile_manager.h" |
| 25 #include "chrome/browser/search_engines/template_url_service_factory.h" | 26 #include "chrome/browser/search_engines/template_url_service_factory.h" |
| 26 #include "chrome/browser/signin/about_signin_internals_factory.h" | 27 #include "chrome/browser/signin/about_signin_internals_factory.h" |
| 27 #include "chrome/browser/signin/chrome_signin_client_factory.h" | 28 #include "chrome/browser/signin/chrome_signin_client_factory.h" |
| 28 #include "chrome/browser/signin/gaia_cookie_manager_service_factory.h" | 29 #include "chrome/browser/signin/gaia_cookie_manager_service_factory.h" |
| 29 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" | 30 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" |
| 30 #include "chrome/browser/signin/signin_manager_factory.h" | 31 #include "chrome/browser/signin/signin_manager_factory.h" |
| 32 #include "chrome/browser/spellchecker/spellcheck_factory.h" |
| 31 #include "chrome/browser/sync/chrome_sync_client.h" | 33 #include "chrome/browser/sync/chrome_sync_client.h" |
| 34 #include "chrome/browser/sync/sessions/sync_sessions_web_contents_router_factory
.h" |
| 32 #include "chrome/browser/sync/supervised_user_signin_manager_wrapper.h" | 35 #include "chrome/browser/sync/supervised_user_signin_manager_wrapper.h" |
| 33 #include "chrome/browser/themes/theme_service_factory.h" | 36 #include "chrome/browser/themes/theme_service_factory.h" |
| 37 #include "chrome/browser/undo/bookmark_undo_service_factory.h" |
| 34 #include "chrome/browser/web_data_service_factory.h" | 38 #include "chrome/browser/web_data_service_factory.h" |
| 35 #include "chrome/common/channel_info.h" | 39 #include "chrome/common/channel_info.h" |
| 36 #include "components/browser_sync/profile_sync_components_factory_impl.h" | 40 #include "components/browser_sync/profile_sync_components_factory_impl.h" |
| 37 #include "components/browser_sync/profile_sync_service.h" | 41 #include "components/browser_sync/profile_sync_service.h" |
| 38 #include "components/keyed_service/content/browser_context_dependency_manager.h" | 42 #include "components/keyed_service/content/browser_context_dependency_manager.h" |
| 39 #include "components/network_time/network_time_tracker.h" | 43 #include "components/network_time/network_time_tracker.h" |
| 40 #include "components/signin/core/browser/profile_oauth2_token_service.h" | 44 #include "components/signin/core/browser/profile_oauth2_token_service.h" |
| 41 #include "components/signin/core/browser/signin_manager.h" | 45 #include "components/signin/core/browser/signin_manager.h" |
| 42 #include "components/sync/driver/signin_manager_wrapper.h" | 46 #include "components/sync/driver/signin_manager_wrapper.h" |
| 43 #include "components/sync/driver/startup_controller.h" | 47 #include "components/sync/driver/startup_controller.h" |
| 44 #include "components/sync/driver/sync_util.h" | 48 #include "components/sync/driver/sync_util.h" |
| 45 #include "content/public/browser/browser_thread.h" | 49 #include "content/public/browser/browser_thread.h" |
| 46 #include "extensions/features/features.h" | 50 #include "extensions/features/features.h" |
| 47 #include "url/gurl.h" | 51 #include "url/gurl.h" |
| 48 | 52 |
| 49 #if BUILDFLAG(ENABLE_EXTENSIONS) | 53 #if BUILDFLAG(ENABLE_EXTENSIONS) |
| 50 #include "extensions/browser/extension_system_provider.h" | 54 #include "extensions/browser/extension_system_provider.h" |
| 51 #include "extensions/browser/extensions_browser_client.h" | 55 #include "extensions/browser/extensions_browser_client.h" |
| 52 #endif | 56 #endif // BUILDFLAG(ENABLE_EXTENSIONS) |
| 57 |
| 58 #if BUILDFLAG(ENABLE_SUPERVISED_USERS) |
| 59 #include "chrome/browser/supervised_user/legacy/supervised_user_shared_settings_
service_factory.h" |
| 60 #include "chrome/browser/supervised_user/legacy/supervised_user_sync_service_fac
tory.h" |
| 61 #include "chrome/browser/supervised_user/supervised_user_service_factory.h" |
| 62 #include "chrome/browser/supervised_user/supervised_user_settings_service_factor
y.h" |
| 63 #endif // BUILDFLAG(ENABLE_SUPERVISED_USERS) |
| 53 | 64 |
| 54 #if !defined(OS_ANDROID) | 65 #if !defined(OS_ANDROID) |
| 55 #include "chrome/browser/ui/global_error/global_error_service_factory.h" | 66 #include "chrome/browser/ui/global_error/global_error_service_factory.h" |
| 56 #endif | 67 #endif // !defined(OS_ANDROID) |
| 68 |
| 69 #if defined(OS_CHROMEOS) |
| 70 #include "chrome/browser/chromeos/printing/printers_manager_factory.h" |
| 71 #include "components/sync_wifi/wifi_credential_syncable_service_factory.h" |
| 72 #endif // defined(OS_CHROMEOS) |
| 57 | 73 |
| 58 using browser_sync::ProfileSyncService; | 74 using browser_sync::ProfileSyncService; |
| 59 | 75 |
| 60 namespace { | 76 namespace { |
| 61 | 77 |
| 62 void UpdateNetworkTimeOnUIThread(base::Time network_time, | 78 void UpdateNetworkTimeOnUIThread(base::Time network_time, |
| 63 base::TimeDelta resolution, | 79 base::TimeDelta resolution, |
| 64 base::TimeDelta latency, | 80 base::TimeDelta latency, |
| 65 base::TimeTicks post_time) { | 81 base::TimeTicks post_time) { |
| 66 g_browser_process->network_time_tracker()->UpdateNetworkTime( | 82 g_browser_process->network_time_tracker()->UpdateNetworkTime( |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 ProfileSyncServiceFactory::ProfileSyncServiceFactory() | 118 ProfileSyncServiceFactory::ProfileSyncServiceFactory() |
| 103 : BrowserContextKeyedServiceFactory( | 119 : BrowserContextKeyedServiceFactory( |
| 104 "ProfileSyncService", | 120 "ProfileSyncService", |
| 105 BrowserContextDependencyManager::GetInstance()) { | 121 BrowserContextDependencyManager::GetInstance()) { |
| 106 // The ProfileSyncService depends on various SyncableServices being around | 122 // The ProfileSyncService depends on various SyncableServices being around |
| 107 // when it is shut down. Specify those dependencies here to build the proper | 123 // when it is shut down. Specify those dependencies here to build the proper |
| 108 // destruction order. | 124 // destruction order. |
| 109 DependsOn(AboutSigninInternalsFactory::GetInstance()); | 125 DependsOn(AboutSigninInternalsFactory::GetInstance()); |
| 110 DependsOn(autofill::PersonalDataManagerFactory::GetInstance()); | 126 DependsOn(autofill::PersonalDataManagerFactory::GetInstance()); |
| 111 DependsOn(BookmarkModelFactory::GetInstance()); | 127 DependsOn(BookmarkModelFactory::GetInstance()); |
| 128 DependsOn(BookmarkUndoServiceFactory::GetInstance()); |
| 112 DependsOn(ChromeSigninClientFactory::GetInstance()); | 129 DependsOn(ChromeSigninClientFactory::GetInstance()); |
| 130 DependsOn(dom_distiller::DomDistillerServiceFactory::GetInstance()); |
| 113 DependsOn(GaiaCookieManagerServiceFactory::GetInstance()); | 131 DependsOn(GaiaCookieManagerServiceFactory::GetInstance()); |
| 132 DependsOn(gcm::GCMProfileServiceFactory::GetInstance()); |
| 114 #if !defined(OS_ANDROID) | 133 #if !defined(OS_ANDROID) |
| 115 DependsOn(GlobalErrorServiceFactory::GetInstance()); | 134 DependsOn(GlobalErrorServiceFactory::GetInstance()); |
| 116 DependsOn(ThemeServiceFactory::GetInstance()); | 135 DependsOn(ThemeServiceFactory::GetInstance()); |
| 117 #endif | 136 #endif // !defined(OS_ANDROID) |
| 118 DependsOn(HistoryServiceFactory::GetInstance()); | 137 DependsOn(HistoryServiceFactory::GetInstance()); |
| 119 DependsOn(invalidation::ProfileInvalidationProviderFactory::GetInstance()); | 138 DependsOn(invalidation::ProfileInvalidationProviderFactory::GetInstance()); |
| 120 DependsOn(PasswordStoreFactory::GetInstance()); | 139 DependsOn(PasswordStoreFactory::GetInstance()); |
| 121 DependsOn(ProfileOAuth2TokenServiceFactory::GetInstance()); | 140 DependsOn(ProfileOAuth2TokenServiceFactory::GetInstance()); |
| 122 DependsOn(SigninManagerFactory::GetInstance()); | 141 DependsOn(SigninManagerFactory::GetInstance()); |
| 142 DependsOn(SpellcheckServiceFactory::GetInstance()); |
| 143 #if BUILDFLAG(ENABLE_SUPERVISED_USERS) |
| 144 // TODO(skym, crbug.com/705545): Fix this circular dependency. |
| 145 // DependsOn(SupervisedUserServiceFactory::GetInstance()); |
| 146 DependsOn(SupervisedUserSettingsServiceFactory::GetInstance()); |
| 147 #if !defined(OS_ANDROID) |
| 148 DependsOn(SupervisedUserSharedSettingsServiceFactory::GetInstance()); |
| 149 DependsOn(SupervisedUserSyncServiceFactory::GetInstance()); |
| 150 #endif // !defined(OS_ANDROID) |
| 151 #endif // BUILDFLAG(ENABLE_SUPERVISED_USERS) |
| 152 DependsOn(sync_sessions::SyncSessionsWebContentsRouterFactory::GetInstance()); |
| 123 DependsOn(TemplateURLServiceFactory::GetInstance()); | 153 DependsOn(TemplateURLServiceFactory::GetInstance()); |
| 124 DependsOn(WebDataServiceFactory::GetInstance()); | 154 DependsOn(WebDataServiceFactory::GetInstance()); |
| 125 #if BUILDFLAG(ENABLE_EXTENSIONS) | 155 #if BUILDFLAG(ENABLE_EXTENSIONS) |
| 126 DependsOn( | 156 DependsOn( |
| 127 extensions::ExtensionsBrowserClient::Get()->GetExtensionSystemFactory()); | 157 extensions::ExtensionsBrowserClient::Get()->GetExtensionSystemFactory()); |
| 128 #endif | 158 #endif // BUILDFLAG(ENABLE_EXTENSIONS) |
| 159 #if defined(OS_CHROMEOS) |
| 160 DependsOn(chromeos::PrintersManagerFactory::GetInstance()); |
| 161 DependsOn(sync_wifi::WifiCredentialSyncableServiceFactory::GetInstance()); |
| 162 #endif // defined(OS_CHROMEOS) |
| 129 | 163 |
| 130 // The following have not been converted to KeyedServices yet, | 164 // The following have not been converted to KeyedServices yet, |
| 131 // and for now they are explicitly destroyed after the | 165 // and for now they are explicitly destroyed after the |
| 132 // BrowserContextDependencyManager is told to DestroyBrowserContextServices, | 166 // BrowserContextDependencyManager is told to DestroyBrowserContextServices, |
| 133 // so they will be around when the ProfileSyncService is destroyed. | 167 // so they will be around when the ProfileSyncService is destroyed. |
| 134 | 168 |
| 135 // DependsOn(FaviconServiceFactory::GetInstance()); | 169 // DependsOn(FaviconServiceFactory::GetInstance()); |
| 136 } | 170 } |
| 137 | 171 |
| 138 ProfileSyncServiceFactory::~ProfileSyncServiceFactory() { | 172 ProfileSyncServiceFactory::~ProfileSyncServiceFactory() { |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 | 258 |
| 225 // static | 259 // static |
| 226 void ProfileSyncServiceFactory::SetSyncClientFactoryForTest( | 260 void ProfileSyncServiceFactory::SetSyncClientFactoryForTest( |
| 227 SyncClientFactory* client_factory) { | 261 SyncClientFactory* client_factory) { |
| 228 client_factory_ = client_factory; | 262 client_factory_ = client_factory; |
| 229 } | 263 } |
| 230 | 264 |
| 231 // static | 265 // static |
| 232 ProfileSyncServiceFactory::SyncClientFactory* | 266 ProfileSyncServiceFactory::SyncClientFactory* |
| 233 ProfileSyncServiceFactory::client_factory_ = nullptr; | 267 ProfileSyncServiceFactory::client_factory_ = nullptr; |
| OLD | NEW |