| 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 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 base::MakeUnique<browser_sync::ChromeSyncClient>(profile); | 176 base::MakeUnique<browser_sync::ChromeSyncClient>(profile); |
| 177 } else { | 177 } else { |
| 178 init_params.sync_client = client_factory_->Run(profile); | 178 init_params.sync_client = client_factory_->Run(profile); |
| 179 } | 179 } |
| 180 | 180 |
| 181 init_params.network_time_update_callback = base::Bind(&UpdateNetworkTime); | 181 init_params.network_time_update_callback = base::Bind(&UpdateNetworkTime); |
| 182 init_params.base_directory = profile->GetPath(); | 182 init_params.base_directory = profile->GetPath(); |
| 183 init_params.url_request_context = profile->GetRequestContext(); | 183 init_params.url_request_context = profile->GetRequestContext(); |
| 184 init_params.debug_identifier = profile->GetDebugName(); | 184 init_params.debug_identifier = profile->GetDebugName(); |
| 185 init_params.channel = chrome::GetChannel(); | 185 init_params.channel = chrome::GetChannel(); |
| 186 | |
| 187 init_params.db_thread = content::BrowserThread::GetTaskRunnerForThread( | |
| 188 content::BrowserThread::DB); | |
| 189 init_params.file_thread = content::BrowserThread::GetTaskRunnerForThread( | |
| 190 content::BrowserThread::FILE); | |
| 191 init_params.blocking_pool = content::BrowserThread::GetBlockingPool(); | 186 init_params.blocking_pool = content::BrowserThread::GetBlockingPool(); |
| 192 | 187 |
| 193 auto pss = base::MakeUnique<ProfileSyncService>(std::move(init_params)); | 188 auto pss = base::MakeUnique<ProfileSyncService>(std::move(init_params)); |
| 194 | 189 |
| 195 // Will also initialize the sync client. | 190 // Will also initialize the sync client. |
| 196 pss->Initialize(); | 191 pss->Initialize(); |
| 197 return pss.release(); | 192 return pss.release(); |
| 198 } | 193 } |
| 199 | 194 |
| 200 // static | 195 // static |
| 201 bool ProfileSyncServiceFactory::HasProfileSyncService(Profile* profile) { | 196 bool ProfileSyncServiceFactory::HasProfileSyncService(Profile* profile) { |
| 202 return GetInstance()->GetServiceForBrowserContext(profile, false) != nullptr; | 197 return GetInstance()->GetServiceForBrowserContext(profile, false) != nullptr; |
| 203 } | 198 } |
| 204 | 199 |
| 205 // static | 200 // static |
| 206 void ProfileSyncServiceFactory::SetSyncClientFactoryForTest( | 201 void ProfileSyncServiceFactory::SetSyncClientFactoryForTest( |
| 207 SyncClientFactory* client_factory) { | 202 SyncClientFactory* client_factory) { |
| 208 client_factory_ = client_factory; | 203 client_factory_ = client_factory; |
| 209 } | 204 } |
| 210 | 205 |
| 211 // static | 206 // static |
| 212 ProfileSyncServiceFactory::SyncClientFactory* | 207 ProfileSyncServiceFactory::SyncClientFactory* |
| 213 ProfileSyncServiceFactory::client_factory_ = nullptr; | 208 ProfileSyncServiceFactory::client_factory_ = nullptr; |
| OLD | NEW |