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 syncer::SyncService* ProfileSyncServiceFactory::GetSyncServiceForBrowserContext( | 94 sync_driver::SyncService* |
| 95 ProfileSyncServiceFactory::GetSyncServiceForBrowserContext( |
95 content::BrowserContext* context) { | 96 content::BrowserContext* context) { |
96 return GetForProfile(Profile::FromBrowserContext(context)); | 97 return GetForProfile(Profile::FromBrowserContext(context)); |
97 } | 98 } |
98 | 99 |
99 ProfileSyncServiceFactory::ProfileSyncServiceFactory() | 100 ProfileSyncServiceFactory::ProfileSyncServiceFactory() |
100 : BrowserContextKeyedServiceFactory( | 101 : BrowserContextKeyedServiceFactory( |
101 "ProfileSyncService", | 102 "ProfileSyncService", |
102 BrowserContextDependencyManager::GetInstance()) { | 103 BrowserContextDependencyManager::GetInstance()) { |
103 // The ProfileSyncService depends on various SyncableServices being around | 104 // The ProfileSyncService depends on various SyncableServices being around |
104 // when it is shut down. Specify those dependencies here to build the proper | 105 // 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... |
204 | 205 |
205 // static | 206 // static |
206 void ProfileSyncServiceFactory::SetSyncClientFactoryForTest( | 207 void ProfileSyncServiceFactory::SetSyncClientFactoryForTest( |
207 SyncClientFactory* client_factory) { | 208 SyncClientFactory* client_factory) { |
208 client_factory_ = client_factory; | 209 client_factory_ = client_factory; |
209 } | 210 } |
210 | 211 |
211 // static | 212 // static |
212 ProfileSyncServiceFactory::SyncClientFactory* | 213 ProfileSyncServiceFactory::SyncClientFactory* |
213 ProfileSyncServiceFactory::client_factory_ = nullptr; | 214 ProfileSyncServiceFactory::client_factory_ = nullptr; |
OLD | NEW |