| 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 "base/prefs/pref_service.h" | 9 #include "base/prefs/pref_service.h" |
| 10 #include "chrome/browser/autofill/personal_data_manager_factory.h" | 10 #include "chrome/browser/autofill/personal_data_manager_factory.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 #include "chrome/browser/signin/chrome_signin_client_factory.h" | 22 #include "chrome/browser/signin/chrome_signin_client_factory.h" |
| 23 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" | 23 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" |
| 24 #include "chrome/browser/signin/signin_manager_factory.h" | 24 #include "chrome/browser/signin/signin_manager_factory.h" |
| 25 #include "chrome/browser/sync/profile_sync_components_factory_impl.h" | 25 #include "chrome/browser/sync/profile_sync_components_factory_impl.h" |
| 26 #include "chrome/browser/sync/profile_sync_service.h" | 26 #include "chrome/browser/sync/profile_sync_service.h" |
| 27 #include "chrome/browser/sync/startup_controller.h" | 27 #include "chrome/browser/sync/startup_controller.h" |
| 28 #include "chrome/browser/sync/supervised_user_signin_manager_wrapper.h" | 28 #include "chrome/browser/sync/supervised_user_signin_manager_wrapper.h" |
| 29 #include "chrome/browser/themes/theme_service_factory.h" | 29 #include "chrome/browser/themes/theme_service_factory.h" |
| 30 #include "chrome/browser/ui/global_error/global_error_service_factory.h" | 30 #include "chrome/browser/ui/global_error/global_error_service_factory.h" |
| 31 #include "chrome/browser/web_data_service_factory.h" | 31 #include "chrome/browser/web_data_service_factory.h" |
| 32 #include "chrome/common/sync_util.h" | 32 #include "chrome/common/channel_info.h" |
| 33 #include "components/keyed_service/content/browser_context_dependency_manager.h" | 33 #include "components/keyed_service/content/browser_context_dependency_manager.h" |
| 34 #include "components/signin/core/browser/profile_oauth2_token_service.h" | 34 #include "components/signin/core/browser/profile_oauth2_token_service.h" |
| 35 #include "components/signin/core/browser/signin_manager.h" | 35 #include "components/signin/core/browser/signin_manager.h" |
| 36 #include "components/sync_driver/sync_util.h" |
| 36 #include "components/variations/variations_associated_data.h" | 37 #include "components/variations/variations_associated_data.h" |
| 37 #include "url/gurl.h" | 38 #include "url/gurl.h" |
| 38 | 39 |
| 39 #if defined(ENABLE_EXTENSIONS) | 40 #if defined(ENABLE_EXTENSIONS) |
| 40 #include "extensions/browser/extension_system_provider.h" | 41 #include "extensions/browser/extension_system_provider.h" |
| 41 #include "extensions/browser/extensions_browser_client.h" | 42 #include "extensions/browser/extensions_browser_client.h" |
| 42 #endif | 43 #endif |
| 43 | 44 |
| 44 // static | 45 // static |
| 45 ProfileSyncServiceFactory* ProfileSyncServiceFactory::GetInstance() { | 46 ProfileSyncServiceFactory* ProfileSyncServiceFactory::GetInstance() { |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 | 119 |
| 119 // Always create the GCMProfileService instance such that we can listen to | 120 // Always create the GCMProfileService instance such that we can listen to |
| 120 // the profile notifications and purge the GCM store when the profile is | 121 // the profile notifications and purge the GCM store when the profile is |
| 121 // being signed out. | 122 // being signed out. |
| 122 gcm::GCMProfileServiceFactory::GetForProfile(profile); | 123 gcm::GCMProfileServiceFactory::GetForProfile(profile); |
| 123 | 124 |
| 124 // TODO(atwilson): Change AboutSigninInternalsFactory to load on startup | 125 // TODO(atwilson): Change AboutSigninInternalsFactory to load on startup |
| 125 // once http://crbug.com/171406 has been fixed. | 126 // once http://crbug.com/171406 has been fixed. |
| 126 AboutSigninInternalsFactory::GetForProfile(profile); | 127 AboutSigninInternalsFactory::GetForProfile(profile); |
| 127 | 128 |
| 128 const GURL sync_service_url = | 129 const GURL sync_service_url = GetSyncServiceURL( |
| 129 GetSyncServiceURL(*base::CommandLine::ForCurrentProcess()); | 130 *base::CommandLine::ForCurrentProcess(), chrome::GetChannel()); |
| 130 | 131 |
| 131 scoped_ptr<SupervisedUserSigninManagerWrapper> signin_wrapper( | 132 scoped_ptr<SupervisedUserSigninManagerWrapper> signin_wrapper( |
| 132 new SupervisedUserSigninManagerWrapper(profile, signin)); | 133 new SupervisedUserSigninManagerWrapper(profile, signin)); |
| 133 std::string account_id = signin_wrapper->GetAccountIdToUse(); | 134 std::string account_id = signin_wrapper->GetAccountIdToUse(); |
| 134 OAuth2TokenService::ScopeSet scope_set; | 135 OAuth2TokenService::ScopeSet scope_set; |
| 135 scope_set.insert(signin_wrapper->GetSyncScopeToUse()); | 136 scope_set.insert(signin_wrapper->GetSyncScopeToUse()); |
| 136 ProfileOAuth2TokenService* token_service = | 137 ProfileOAuth2TokenService* token_service = |
| 137 ProfileOAuth2TokenServiceFactory::GetForProfile(profile); | 138 ProfileOAuth2TokenServiceFactory::GetForProfile(profile); |
| 138 net::URLRequestContextGetter* url_request_context_getter = | 139 net::URLRequestContextGetter* url_request_context_getter = |
| 139 profile->GetRequestContext(); | 140 profile->GetRequestContext(); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 156 pss->factory()->Initialize(pss); | 157 pss->factory()->Initialize(pss); |
| 157 pss->factory()->RegisterDataTypes(); | 158 pss->factory()->RegisterDataTypes(); |
| 158 pss->Initialize(); | 159 pss->Initialize(); |
| 159 return pss; | 160 return pss; |
| 160 } | 161 } |
| 161 | 162 |
| 162 // static | 163 // static |
| 163 bool ProfileSyncServiceFactory::HasProfileSyncService(Profile* profile) { | 164 bool ProfileSyncServiceFactory::HasProfileSyncService(Profile* profile) { |
| 164 return GetInstance()->GetServiceForBrowserContext(profile, false) != NULL; | 165 return GetInstance()->GetServiceForBrowserContext(profile, false) != NULL; |
| 165 } | 166 } |
| OLD | NEW |