| 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/singleton.h" | 9 #include "base/memory/singleton.h" |
| 10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
| 11 #include "build/build_config.h" | 11 #include "build/build_config.h" |
| 12 #include "chrome/browser/autofill/personal_data_manager_factory.h" | 12 #include "chrome/browser/autofill/personal_data_manager_factory.h" |
| 13 #include "chrome/browser/bookmarks/bookmark_model_factory.h" | 13 #include "chrome/browser/bookmarks/bookmark_model_factory.h" |
| 14 #include "chrome/browser/browser_process.h" | 14 #include "chrome/browser/browser_process.h" |
| 15 #include "chrome/browser/defaults.h" | 15 #include "chrome/browser/defaults.h" |
| 16 #include "chrome/browser/history/history_service_factory.h" | 16 #include "chrome/browser/history/history_service_factory.h" |
| 17 #include "chrome/browser/invalidation/profile_invalidation_provider_factory.h" | 17 #include "chrome/browser/invalidation/profile_invalidation_provider_factory.h" |
| 18 #include "chrome/browser/password_manager/password_store_factory.h" | 18 #include "chrome/browser/password_manager/password_store_factory.h" |
| 19 #include "chrome/browser/profiles/profile.h" | 19 #include "chrome/browser/profiles/profile.h" |
| 20 #include "chrome/browser/profiles/profile_manager.h" | 20 #include "chrome/browser/profiles/profile_manager.h" |
| 21 #include "chrome/browser/search_engines/template_url_service_factory.h" | 21 #include "chrome/browser/search_engines/template_url_service_factory.h" |
| 22 #include "chrome/browser/services/gcm/gcm_profile_service_factory.h" | 22 #include "chrome/browser/services/gcm/gcm_profile_service_factory.h" |
| 23 #include "chrome/browser/signin/about_signin_internals_factory.h" | 23 #include "chrome/browser/signin/about_signin_internals_factory.h" |
| 24 #include "chrome/browser/signin/chrome_signin_client_factory.h" | 24 #include "chrome/browser/signin/chrome_signin_client_factory.h" |
| 25 #include "chrome/browser/signin/gaia_cookie_manager_service_factory.h" |
| 25 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" | 26 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" |
| 26 #include "chrome/browser/signin/signin_manager_factory.h" | 27 #include "chrome/browser/signin/signin_manager_factory.h" |
| 27 #include "chrome/browser/sync/chrome_sync_client.h" | 28 #include "chrome/browser/sync/chrome_sync_client.h" |
| 28 #include "chrome/browser/sync/supervised_user_signin_manager_wrapper.h" | 29 #include "chrome/browser/sync/supervised_user_signin_manager_wrapper.h" |
| 29 #include "chrome/browser/themes/theme_service_factory.h" | 30 #include "chrome/browser/themes/theme_service_factory.h" |
| 30 #include "chrome/browser/web_data_service_factory.h" | 31 #include "chrome/browser/web_data_service_factory.h" |
| 31 #include "chrome/common/channel_info.h" | 32 #include "chrome/common/channel_info.h" |
| 32 #include "components/browser_sync/browser/profile_sync_components_factory_impl.h
" | 33 #include "components/browser_sync/browser/profile_sync_components_factory_impl.h
" |
| 33 #include "components/browser_sync/browser/profile_sync_service.h" | 34 #include "components/browser_sync/browser/profile_sync_service.h" |
| 34 #include "components/keyed_service/content/browser_context_dependency_manager.h" | 35 #include "components/keyed_service/content/browser_context_dependency_manager.h" |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 : BrowserContextKeyedServiceFactory( | 98 : BrowserContextKeyedServiceFactory( |
| 98 "ProfileSyncService", | 99 "ProfileSyncService", |
| 99 BrowserContextDependencyManager::GetInstance()) { | 100 BrowserContextDependencyManager::GetInstance()) { |
| 100 // The ProfileSyncService depends on various SyncableServices being around | 101 // The ProfileSyncService depends on various SyncableServices being around |
| 101 // when it is shut down. Specify those dependencies here to build the proper | 102 // when it is shut down. Specify those dependencies here to build the proper |
| 102 // destruction order. | 103 // destruction order. |
| 103 DependsOn(AboutSigninInternalsFactory::GetInstance()); | 104 DependsOn(AboutSigninInternalsFactory::GetInstance()); |
| 104 DependsOn(autofill::PersonalDataManagerFactory::GetInstance()); | 105 DependsOn(autofill::PersonalDataManagerFactory::GetInstance()); |
| 105 DependsOn(BookmarkModelFactory::GetInstance()); | 106 DependsOn(BookmarkModelFactory::GetInstance()); |
| 106 DependsOn(ChromeSigninClientFactory::GetInstance()); | 107 DependsOn(ChromeSigninClientFactory::GetInstance()); |
| 108 DependsOn(GaiaCookieManagerServiceFactory::GetInstance()); |
| 107 #if !defined(OS_ANDROID) | 109 #if !defined(OS_ANDROID) |
| 108 DependsOn(GlobalErrorServiceFactory::GetInstance()); | 110 DependsOn(GlobalErrorServiceFactory::GetInstance()); |
| 109 #endif | 111 #endif |
| 110 DependsOn(HistoryServiceFactory::GetInstance()); | 112 DependsOn(HistoryServiceFactory::GetInstance()); |
| 111 DependsOn(invalidation::ProfileInvalidationProviderFactory::GetInstance()); | 113 DependsOn(invalidation::ProfileInvalidationProviderFactory::GetInstance()); |
| 112 DependsOn(PasswordStoreFactory::GetInstance()); | 114 DependsOn(PasswordStoreFactory::GetInstance()); |
| 113 DependsOn(ProfileOAuth2TokenServiceFactory::GetInstance()); | 115 DependsOn(ProfileOAuth2TokenServiceFactory::GetInstance()); |
| 114 DependsOn(SigninManagerFactory::GetInstance()); | 116 DependsOn(SigninManagerFactory::GetInstance()); |
| 115 DependsOn(TemplateURLServiceFactory::GetInstance()); | 117 DependsOn(TemplateURLServiceFactory::GetInstance()); |
| 116 #if defined(ENABLE_THEMES) | 118 #if defined(ENABLE_THEMES) |
| (...skipping 28 matching lines...) Expand all Loading... |
| 145 // the profile notifications and purge the GCM store when the profile is | 147 // the profile notifications and purge the GCM store when the profile is |
| 146 // being signed out. | 148 // being signed out. |
| 147 gcm::GCMProfileServiceFactory::GetForProfile(profile); | 149 gcm::GCMProfileServiceFactory::GetForProfile(profile); |
| 148 | 150 |
| 149 // TODO(atwilson): Change AboutSigninInternalsFactory to load on startup | 151 // TODO(atwilson): Change AboutSigninInternalsFactory to load on startup |
| 150 // once http://crbug.com/171406 has been fixed. | 152 // once http://crbug.com/171406 has been fixed. |
| 151 AboutSigninInternalsFactory::GetForProfile(profile); | 153 AboutSigninInternalsFactory::GetForProfile(profile); |
| 152 | 154 |
| 153 init_params.signin_wrapper = | 155 init_params.signin_wrapper = |
| 154 make_scoped_ptr(new SupervisedUserSigninManagerWrapper(profile, signin)); | 156 make_scoped_ptr(new SupervisedUserSigninManagerWrapper(profile, signin)); |
| 155 | |
| 156 init_params.oauth2_token_service = | 157 init_params.oauth2_token_service = |
| 157 ProfileOAuth2TokenServiceFactory::GetForProfile(profile); | 158 ProfileOAuth2TokenServiceFactory::GetForProfile(profile); |
| 159 init_params.gaia_cookie_manager_service = |
| 160 GaiaCookieManagerServiceFactory::GetForProfile(profile); |
| 158 | 161 |
| 159 // TODO(tim): Currently, AUTO/MANUAL settings refer to the *first* time sync | 162 // TODO(tim): Currently, AUTO/MANUAL settings refer to the *first* time sync |
| 160 // is set up and *not* a browser restart for a manual-start platform (where | 163 // is set up and *not* a browser restart for a manual-start platform (where |
| 161 // sync has already been set up, and should be able to start without user | 164 // sync has already been set up, and should be able to start without user |
| 162 // intervention). We can get rid of the browser_default eventually, but | 165 // intervention). We can get rid of the browser_default eventually, but |
| 163 // need to take care that ProfileSyncService doesn't get tripped up between | 166 // need to take care that ProfileSyncService doesn't get tripped up between |
| 164 // those two cases. Bug 88109. | 167 // those two cases. Bug 88109. |
| 165 init_params.start_behavior = browser_defaults::kSyncAutoStarts | 168 init_params.start_behavior = browser_defaults::kSyncAutoStarts |
| 166 ? ProfileSyncService::AUTO_START | 169 ? ProfileSyncService::AUTO_START |
| 167 : ProfileSyncService::MANUAL_START; | 170 : ProfileSyncService::MANUAL_START; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 186 | 189 |
| 187 // Will also initialize the sync client. | 190 // Will also initialize the sync client. |
| 188 pss->Initialize(); | 191 pss->Initialize(); |
| 189 return pss.release(); | 192 return pss.release(); |
| 190 } | 193 } |
| 191 | 194 |
| 192 // static | 195 // static |
| 193 bool ProfileSyncServiceFactory::HasProfileSyncService(Profile* profile) { | 196 bool ProfileSyncServiceFactory::HasProfileSyncService(Profile* profile) { |
| 194 return GetInstance()->GetServiceForBrowserContext(profile, false) != NULL; | 197 return GetInstance()->GetServiceForBrowserContext(profile, false) != NULL; |
| 195 } | 198 } |
| OLD | NEW |