Chromium Code Reviews| Index: chrome/browser/sync/profile_sync_service_factory.h |
| diff --git a/chrome/browser/sync/profile_sync_service_factory.h b/chrome/browser/sync/profile_sync_service_factory.h |
| index 31d0c4d07e8c3d31cc90175b9fe644da369adbbc..4c8c6c9e30238dbd69f69c3611a8b733a18e11f2 100644 |
| --- a/chrome/browser/sync/profile_sync_service_factory.h |
| +++ b/chrome/browser/sync/profile_sync_service_factory.h |
| @@ -14,6 +14,7 @@ struct DefaultSingletonTraits; |
| } |
| namespace sync_driver { |
| +class SyncClient; |
| class SyncService; |
| } |
| @@ -22,6 +23,9 @@ class ProfileSyncService; |
| class ProfileSyncServiceFactory : public BrowserContextKeyedServiceFactory { |
| public: |
| + typedef base::Callback<std::unique_ptr<sync_driver::SyncClient>(Profile*)> |
| + SyncClientFactory; |
| + |
| static ProfileSyncService* GetForProfile(Profile* profile); |
| static bool HasProfileSyncService(Profile* profile); |
| @@ -32,6 +36,9 @@ class ProfileSyncServiceFactory : public BrowserContextKeyedServiceFactory { |
| static ProfileSyncServiceFactory* GetInstance(); |
| + // Overrides how the SyncClient is created for testing purposes. |
| + static void SetSyncClientFactoryForTest(SyncClientFactory* client_factory); |
| + |
| private: |
| friend struct base::DefaultSingletonTraits<ProfileSyncServiceFactory>; |
| @@ -42,6 +49,10 @@ class ProfileSyncServiceFactory : public BrowserContextKeyedServiceFactory { |
| KeyedService* BuildServiceInstanceFor( |
| content::BrowserContext* context) const override; |
| + // A factory function for overriding the way the SyncClient is created. |
| + // This is a raw pointer so it can be statically initialized. |
|
skym
2016/09/12 19:57:49
So does this mean you cannot statically initialize
maxbogue
2016/09/13 03:44:54
Non-const static variables must be POD types, from
|
| + static SyncClientFactory* client_factory_; |
| + |
| DISALLOW_COPY_AND_ASSIGN(ProfileSyncServiceFactory); |
| }; |