| 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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 ProfileSyncService* ProfileSyncServiceFactory::GetForProfile( | 84 ProfileSyncService* ProfileSyncServiceFactory::GetForProfile( |
| 85 Profile* profile) { | 85 Profile* profile) { |
| 86 if (!ProfileSyncService::IsSyncAllowedByFlag()) | 86 if (!ProfileSyncService::IsSyncAllowedByFlag()) |
| 87 return nullptr; | 87 return nullptr; |
| 88 | 88 |
| 89 return static_cast<ProfileSyncService*>( | 89 return static_cast<ProfileSyncService*>( |
| 90 GetInstance()->GetServiceForBrowserContext(profile, true)); | 90 GetInstance()->GetServiceForBrowserContext(profile, true)); |
| 91 } | 91 } |
| 92 | 92 |
| 93 // static | 93 // static |
| 94 sync_driver::SyncService* | 94 syncer::SyncService* ProfileSyncServiceFactory::GetSyncServiceForBrowserContext( |
| 95 ProfileSyncServiceFactory::GetSyncServiceForBrowserContext( | |
| 96 content::BrowserContext* context) { | 95 content::BrowserContext* context) { |
| 97 return GetForProfile(Profile::FromBrowserContext(context)); | 96 return GetForProfile(Profile::FromBrowserContext(context)); |
| 98 } | 97 } |
| 99 | 98 |
| 100 ProfileSyncServiceFactory::ProfileSyncServiceFactory() | 99 ProfileSyncServiceFactory::ProfileSyncServiceFactory() |
| 101 : BrowserContextKeyedServiceFactory( | 100 : BrowserContextKeyedServiceFactory( |
| 102 "ProfileSyncService", | 101 "ProfileSyncService", |
| 103 BrowserContextDependencyManager::GetInstance()) { | 102 BrowserContextDependencyManager::GetInstance()) { |
| 104 // The ProfileSyncService depends on various SyncableServices being around | 103 // The ProfileSyncService depends on various SyncableServices being around |
| 105 // when it is shut down. Specify those dependencies here to build the proper | 104 // when it is shut down. Specify those dependencies here to build the proper |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 | 204 |
| 206 // static | 205 // static |
| 207 void ProfileSyncServiceFactory::SetSyncClientFactoryForTest( | 206 void ProfileSyncServiceFactory::SetSyncClientFactoryForTest( |
| 208 SyncClientFactory* client_factory) { | 207 SyncClientFactory* client_factory) { |
| 209 client_factory_ = client_factory; | 208 client_factory_ = client_factory; |
| 210 } | 209 } |
| 211 | 210 |
| 212 // static | 211 // static |
| 213 ProfileSyncServiceFactory::SyncClientFactory* | 212 ProfileSyncServiceFactory::SyncClientFactory* |
| 214 ProfileSyncServiceFactory::client_factory_ = nullptr; | 213 ProfileSyncServiceFactory::client_factory_ = nullptr; |
| OLD | NEW |