| 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/singleton.h" | 10 #include "base/memory/singleton.h" |
| 10 #include "base/time/time.h" | 11 #include "base/time/time.h" |
| 11 #include "build/build_config.h" | 12 #include "build/build_config.h" |
| 12 #include "chrome/browser/autofill/personal_data_manager_factory.h" | 13 #include "chrome/browser/autofill/personal_data_manager_factory.h" |
| 13 #include "chrome/browser/bookmarks/bookmark_model_factory.h" | 14 #include "chrome/browser/bookmarks/bookmark_model_factory.h" |
| 14 #include "chrome/browser/browser_process.h" | 15 #include "chrome/browser/browser_process.h" |
| 15 #include "chrome/browser/defaults.h" | 16 #include "chrome/browser/defaults.h" |
| 16 #include "chrome/browser/history/history_service_factory.h" | 17 #include "chrome/browser/history/history_service_factory.h" |
| 17 #include "chrome/browser/invalidation/profile_invalidation_provider_factory.h" | 18 #include "chrome/browser/invalidation/profile_invalidation_provider_factory.h" |
| 18 #include "chrome/browser/password_manager/password_store_factory.h" | 19 #include "chrome/browser/password_manager/password_store_factory.h" |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 // Always create the GCMProfileService instance such that we can listen to | 147 // Always create the GCMProfileService instance such that we can listen to |
| 147 // the profile notifications and purge the GCM store when the profile is | 148 // the profile notifications and purge the GCM store when the profile is |
| 148 // being signed out. | 149 // being signed out. |
| 149 gcm::GCMProfileServiceFactory::GetForProfile(profile); | 150 gcm::GCMProfileServiceFactory::GetForProfile(profile); |
| 150 | 151 |
| 151 // TODO(atwilson): Change AboutSigninInternalsFactory to load on startup | 152 // TODO(atwilson): Change AboutSigninInternalsFactory to load on startup |
| 152 // once http://crbug.com/171406 has been fixed. | 153 // once http://crbug.com/171406 has been fixed. |
| 153 AboutSigninInternalsFactory::GetForProfile(profile); | 154 AboutSigninInternalsFactory::GetForProfile(profile); |
| 154 | 155 |
| 155 init_params.signin_wrapper = | 156 init_params.signin_wrapper = |
| 156 make_scoped_ptr(new SupervisedUserSigninManagerWrapper(profile, signin)); | 157 base::WrapUnique(new SupervisedUserSigninManagerWrapper(profile, signin)); |
| 157 init_params.oauth2_token_service = | 158 init_params.oauth2_token_service = |
| 158 ProfileOAuth2TokenServiceFactory::GetForProfile(profile); | 159 ProfileOAuth2TokenServiceFactory::GetForProfile(profile); |
| 159 init_params.gaia_cookie_manager_service = | 160 init_params.gaia_cookie_manager_service = |
| 160 GaiaCookieManagerServiceFactory::GetForProfile(profile); | 161 GaiaCookieManagerServiceFactory::GetForProfile(profile); |
| 161 | 162 |
| 162 // TODO(tim): Currently, AUTO/MANUAL settings refer to the *first* time sync | 163 // TODO(tim): Currently, AUTO/MANUAL settings refer to the *first* time sync |
| 163 // is set up and *not* a browser restart for a manual-start platform (where | 164 // is set up and *not* a browser restart for a manual-start platform (where |
| 164 // sync has already been set up, and should be able to start without user | 165 // sync has already been set up, and should be able to start without user |
| 165 // intervention). We can get rid of the browser_default eventually, but | 166 // intervention). We can get rid of the browser_default eventually, but |
| 166 // need to take care that ProfileSyncService doesn't get tripped up between | 167 // need to take care that ProfileSyncService doesn't get tripped up between |
| 167 // those two cases. Bug 88109. | 168 // those two cases. Bug 88109. |
| 168 init_params.start_behavior = browser_defaults::kSyncAutoStarts | 169 init_params.start_behavior = browser_defaults::kSyncAutoStarts |
| 169 ? ProfileSyncService::AUTO_START | 170 ? ProfileSyncService::AUTO_START |
| 170 : ProfileSyncService::MANUAL_START; | 171 : ProfileSyncService::MANUAL_START; |
| 171 | 172 |
| 172 init_params.sync_client = | 173 init_params.sync_client = |
| 173 make_scoped_ptr(new browser_sync::ChromeSyncClient(profile)); | 174 base::WrapUnique(new browser_sync::ChromeSyncClient(profile)); |
| 174 | 175 |
| 175 init_params.network_time_update_callback = base::Bind(&UpdateNetworkTime); | 176 init_params.network_time_update_callback = base::Bind(&UpdateNetworkTime); |
| 176 init_params.base_directory = profile->GetPath(); | 177 init_params.base_directory = profile->GetPath(); |
| 177 init_params.url_request_context = profile->GetRequestContext(); | 178 init_params.url_request_context = profile->GetRequestContext(); |
| 178 init_params.debug_identifier = profile->GetDebugName(); | 179 init_params.debug_identifier = profile->GetDebugName(); |
| 179 init_params.channel = chrome::GetChannel(); | 180 init_params.channel = chrome::GetChannel(); |
| 180 | 181 |
| 181 init_params.db_thread = content::BrowserThread::GetMessageLoopProxyForThread( | 182 init_params.db_thread = content::BrowserThread::GetMessageLoopProxyForThread( |
| 182 content::BrowserThread::DB); | 183 content::BrowserThread::DB); |
| 183 init_params.file_thread = | 184 init_params.file_thread = |
| 184 content::BrowserThread::GetMessageLoopProxyForThread( | 185 content::BrowserThread::GetMessageLoopProxyForThread( |
| 185 content::BrowserThread::FILE); | 186 content::BrowserThread::FILE); |
| 186 init_params.blocking_pool = content::BrowserThread::GetBlockingPool(); | 187 init_params.blocking_pool = content::BrowserThread::GetBlockingPool(); |
| 187 | 188 |
| 188 auto pss = make_scoped_ptr(new ProfileSyncService(std::move(init_params))); | 189 auto pss = base::WrapUnique(new ProfileSyncService(std::move(init_params))); |
| 189 | 190 |
| 190 // Will also initialize the sync client. | 191 // Will also initialize the sync client. |
| 191 pss->Initialize(); | 192 pss->Initialize(); |
| 192 return pss.release(); | 193 return pss.release(); |
| 193 } | 194 } |
| 194 | 195 |
| 195 // static | 196 // static |
| 196 bool ProfileSyncServiceFactory::HasProfileSyncService(Profile* profile) { | 197 bool ProfileSyncServiceFactory::HasProfileSyncService(Profile* profile) { |
| 197 return GetInstance()->GetServiceForBrowserContext(profile, false) != NULL; | 198 return GetInstance()->GetServiceForBrowserContext(profile, false) != NULL; |
| 198 } | 199 } |
| OLD | NEW |