| 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" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 #include "chrome/browser/profiles/profile_manager.h" | 25 #include "chrome/browser/profiles/profile_manager.h" |
| 26 #include "chrome/browser/search_engines/template_url_service_factory.h" | 26 #include "chrome/browser/search_engines/template_url_service_factory.h" |
| 27 #include "chrome/browser/signin/about_signin_internals_factory.h" | 27 #include "chrome/browser/signin/about_signin_internals_factory.h" |
| 28 #include "chrome/browser/signin/chrome_signin_client_factory.h" | 28 #include "chrome/browser/signin/chrome_signin_client_factory.h" |
| 29 #include "chrome/browser/signin/gaia_cookie_manager_service_factory.h" | 29 #include "chrome/browser/signin/gaia_cookie_manager_service_factory.h" |
| 30 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" | 30 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" |
| 31 #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" | 32 #include "chrome/browser/spellchecker/spellcheck_factory.h" |
| 33 #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" | 34 #include "chrome/browser/sync/sessions/sync_sessions_web_contents_router_factory
.h" |
| 35 #include "chrome/browser/sync/supervised_user_signin_manager_wrapper.h" | |
| 36 #include "chrome/browser/sync/user_event_service_factory.h" | 35 #include "chrome/browser/sync/user_event_service_factory.h" |
| 37 #include "chrome/browser/themes/theme_service_factory.h" | 36 #include "chrome/browser/themes/theme_service_factory.h" |
| 38 #include "chrome/browser/undo/bookmark_undo_service_factory.h" | 37 #include "chrome/browser/undo/bookmark_undo_service_factory.h" |
| 39 #include "chrome/browser/web_data_service_factory.h" | 38 #include "chrome/browser/web_data_service_factory.h" |
| 40 #include "chrome/common/channel_info.h" | 39 #include "chrome/common/channel_info.h" |
| 41 #include "components/browser_sync/profile_sync_components_factory_impl.h" | 40 #include "components/browser_sync/profile_sync_components_factory_impl.h" |
| 42 #include "components/browser_sync/profile_sync_service.h" | 41 #include "components/browser_sync/profile_sync_service.h" |
| 43 #include "components/keyed_service/content/browser_context_dependency_manager.h" | 42 #include "components/keyed_service/content/browser_context_dependency_manager.h" |
| 44 #include "components/network_time/network_time_tracker.h" | 43 #include "components/network_time/network_time_tracker.h" |
| 45 #include "components/signin/core/browser/profile_oauth2_token_service.h" | 44 #include "components/signin/core/browser/profile_oauth2_token_service.h" |
| 46 #include "components/signin/core/browser/signin_manager.h" | 45 #include "components/signin/core/browser/signin_manager.h" |
| 47 #include "components/sync/driver/signin_manager_wrapper.h" | 46 #include "components/sync/driver/signin_manager_wrapper.h" |
| 48 #include "components/sync/driver/startup_controller.h" | 47 #include "components/sync/driver/startup_controller.h" |
| 49 #include "components/sync/driver/sync_util.h" | 48 #include "components/sync/driver/sync_util.h" |
| 50 #include "content/public/browser/browser_thread.h" | 49 #include "content/public/browser/browser_thread.h" |
| 51 #include "extensions/features/features.h" | 50 #include "extensions/features/features.h" |
| 52 #include "url/gurl.h" | 51 #include "url/gurl.h" |
| 53 | 52 |
| 54 #if BUILDFLAG(ENABLE_EXTENSIONS) | 53 #if BUILDFLAG(ENABLE_EXTENSIONS) |
| 55 #include "extensions/browser/extension_system_provider.h" | 54 #include "extensions/browser/extension_system_provider.h" |
| 56 #include "extensions/browser/extensions_browser_client.h" | 55 #include "extensions/browser/extensions_browser_client.h" |
| 57 #endif // BUILDFLAG(ENABLE_EXTENSIONS) | 56 #endif // BUILDFLAG(ENABLE_EXTENSIONS) |
| 58 | 57 |
| 59 #if BUILDFLAG(ENABLE_SUPERVISED_USERS) | 58 #if BUILDFLAG(ENABLE_SUPERVISED_USERS) |
| 60 #include "chrome/browser/supervised_user/legacy/supervised_user_shared_settings_
service_factory.h" | 59 #include "chrome/browser/supervised_user/legacy/supervised_user_shared_settings_
service_factory.h" |
| 61 #include "chrome/browser/supervised_user/legacy/supervised_user_sync_service_fac
tory.h" | 60 #include "chrome/browser/supervised_user/legacy/supervised_user_sync_service_fac
tory.h" |
| 62 #include "chrome/browser/supervised_user/supervised_user_service_factory.h" | 61 #include "chrome/browser/supervised_user/supervised_user_service_factory.h" |
| 63 #include "chrome/browser/supervised_user/supervised_user_settings_service_factor
y.h" | 62 #include "chrome/browser/supervised_user/supervised_user_settings_service_factor
y.h" |
| 63 #include "chrome/browser/sync/supervised_user_signin_manager_wrapper.h" |
| 64 #endif // BUILDFLAG(ENABLE_SUPERVISED_USERS) | 64 #endif // BUILDFLAG(ENABLE_SUPERVISED_USERS) |
| 65 | 65 |
| 66 #if !defined(OS_ANDROID) | 66 #if !defined(OS_ANDROID) |
| 67 #include "chrome/browser/ui/global_error/global_error_service_factory.h" | 67 #include "chrome/browser/ui/global_error/global_error_service_factory.h" |
| 68 #endif // !defined(OS_ANDROID) | 68 #endif // !defined(OS_ANDROID) |
| 69 | 69 |
| 70 #if defined(OS_CHROMEOS) | 70 #if defined(OS_CHROMEOS) |
| 71 #include "chrome/browser/chromeos/printing/printers_manager_factory.h" | 71 #include "chrome/browser/chromeos/printing/printers_manager_factory.h" |
| 72 #include "components/sync_wifi/wifi_credential_syncable_service_factory.h" | 72 #include "components/sync_wifi/wifi_credential_syncable_service_factory.h" |
| 73 #endif // defined(OS_CHROMEOS) | 73 #endif // defined(OS_CHROMEOS) |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 208 UMA_HISTOGRAM_BOOLEAN("Sync.Local.RoamingProfileUnavailable", | 208 UMA_HISTOGRAM_BOOLEAN("Sync.Local.RoamingProfileUnavailable", |
| 209 local_sync_backend_folder.empty()); | 209 local_sync_backend_folder.empty()); |
| 210 if (local_sync_backend_folder.empty()) | 210 if (local_sync_backend_folder.empty()) |
| 211 return nullptr; | 211 return nullptr; |
| 212 | 212 |
| 213 init_params.start_behavior = ProfileSyncService::AUTO_START; | 213 init_params.start_behavior = ProfileSyncService::AUTO_START; |
| 214 } | 214 } |
| 215 #endif // defined(OS_WIN) | 215 #endif // defined(OS_WIN) |
| 216 | 216 |
| 217 if (!local_sync_backend_enabled) { | 217 if (!local_sync_backend_enabled) { |
| 218 SigninManagerBase* signin = SigninManagerFactory::GetForProfile(profile); | |
| 219 | |
| 220 // Always create the GCMProfileService instance such that we can listen to | 218 // Always create the GCMProfileService instance such that we can listen to |
| 221 // the profile notifications and purge the GCM store when the profile is | 219 // the profile notifications and purge the GCM store when the profile is |
| 222 // being signed out. | 220 // being signed out. |
| 223 gcm::GCMProfileServiceFactory::GetForProfile(profile); | 221 gcm::GCMProfileServiceFactory::GetForProfile(profile); |
| 224 | 222 |
| 225 // TODO(atwilson): Change AboutSigninInternalsFactory to load on startup | 223 // TODO(atwilson): Change AboutSigninInternalsFactory to load on startup |
| 226 // once http://crbug.com/171406 has been fixed. | 224 // once http://crbug.com/171406 has been fixed. |
| 227 AboutSigninInternalsFactory::GetForProfile(profile); | 225 AboutSigninInternalsFactory::GetForProfile(profile); |
| 228 | 226 |
| 227 #if BUILDFLAG(ENABLE_SUPERVISED_USERS) |
| 228 SigninManagerBase* signin = SigninManagerFactory::GetForProfile(profile); |
| 229 init_params.signin_wrapper = | 229 init_params.signin_wrapper = |
| 230 base::MakeUnique<SupervisedUserSigninManagerWrapper>(profile, signin); | 230 base::MakeUnique<SupervisedUserSigninManagerWrapper>(profile, signin); |
| 231 #endif |
| 231 init_params.oauth2_token_service = | 232 init_params.oauth2_token_service = |
| 232 ProfileOAuth2TokenServiceFactory::GetForProfile(profile); | 233 ProfileOAuth2TokenServiceFactory::GetForProfile(profile); |
| 233 init_params.gaia_cookie_manager_service = | 234 init_params.gaia_cookie_manager_service = |
| 234 GaiaCookieManagerServiceFactory::GetForProfile(profile); | 235 GaiaCookieManagerServiceFactory::GetForProfile(profile); |
| 235 | 236 |
| 236 // TODO(tim): Currently, AUTO/MANUAL settings refer to the *first* time sync | 237 // TODO(tim): Currently, AUTO/MANUAL settings refer to the *first* time sync |
| 237 // is set up and *not* a browser restart for a manual-start platform (where | 238 // is set up and *not* a browser restart for a manual-start platform (where |
| 238 // sync has already been set up, and should be able to start without user | 239 // sync has already been set up, and should be able to start without user |
| 239 // intervention). We can get rid of the browser_default eventually, but | 240 // intervention). We can get rid of the browser_default eventually, but |
| 240 // need to take care that ProfileSyncService doesn't get tripped up between | 241 // need to take care that ProfileSyncService doesn't get tripped up between |
| (...skipping 17 matching lines...) Expand all Loading... |
| 258 | 259 |
| 259 // static | 260 // static |
| 260 void ProfileSyncServiceFactory::SetSyncClientFactoryForTest( | 261 void ProfileSyncServiceFactory::SetSyncClientFactoryForTest( |
| 261 SyncClientFactory* client_factory) { | 262 SyncClientFactory* client_factory) { |
| 262 client_factory_ = client_factory; | 263 client_factory_ = client_factory; |
| 263 } | 264 } |
| 264 | 265 |
| 265 // static | 266 // static |
| 266 ProfileSyncServiceFactory::SyncClientFactory* | 267 ProfileSyncServiceFactory::SyncClientFactory* |
| 267 ProfileSyncServiceFactory::client_factory_ = nullptr; | 268 ProfileSyncServiceFactory::client_factory_ = nullptr; |
| OLD | NEW |