| 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 #ifndef CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_FACTORY_H_ | 5 #ifndef CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_FACTORY_H_ |
| 6 #define CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_FACTORY_H_ | 6 #define CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_FACTORY_H_ |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "components/keyed_service/content/browser_context_keyed_service_factory
.h" | 9 #include "components/keyed_service/content/browser_context_keyed_service_factory
.h" |
| 10 | 10 |
| 11 namespace base { | 11 namespace base { |
| 12 template <typename T> | 12 template <typename T> |
| 13 struct DefaultSingletonTraits; | 13 struct DefaultSingletonTraits; |
| 14 } | 14 } |
| 15 | 15 |
| 16 namespace browser_sync { |
| 17 class ProfileSyncService; |
| 18 } // namespace browser_sync |
| 19 |
| 16 namespace sync_driver { | 20 namespace sync_driver { |
| 17 class SyncClient; | 21 class SyncClient; |
| 18 class SyncService; | 22 class SyncService; |
| 19 } | 23 } |
| 20 | 24 |
| 21 class Profile; | 25 class Profile; |
| 22 class ProfileSyncService; | |
| 23 | 26 |
| 24 class ProfileSyncServiceFactory : public BrowserContextKeyedServiceFactory { | 27 class ProfileSyncServiceFactory : public BrowserContextKeyedServiceFactory { |
| 25 public: | 28 public: |
| 26 typedef base::Callback<std::unique_ptr<sync_driver::SyncClient>(Profile*)> | 29 typedef base::Callback<std::unique_ptr<sync_driver::SyncClient>(Profile*)> |
| 27 SyncClientFactory; | 30 SyncClientFactory; |
| 28 | 31 |
| 29 static ProfileSyncService* GetForProfile(Profile* profile); | 32 static browser_sync::ProfileSyncService* GetForProfile(Profile* profile); |
| 30 static bool HasProfileSyncService(Profile* profile); | 33 static bool HasProfileSyncService(Profile* profile); |
| 31 | 34 |
| 32 // Convenience method that returns the ProfileSyncService as a | 35 // Convenience method that returns the ProfileSyncService as a |
| 33 // sync_driver::SyncService. | 36 // sync_driver::SyncService. |
| 34 static sync_driver::SyncService* GetSyncServiceForBrowserContext( | 37 static sync_driver::SyncService* GetSyncServiceForBrowserContext( |
| 35 content::BrowserContext* context); | 38 content::BrowserContext* context); |
| 36 | 39 |
| 37 static ProfileSyncServiceFactory* GetInstance(); | 40 static ProfileSyncServiceFactory* GetInstance(); |
| 38 | 41 |
| 39 // Overrides how the SyncClient is created for testing purposes. | 42 // Overrides how the SyncClient is created for testing purposes. |
| (...skipping 10 matching lines...) Expand all Loading... |
| 50 content::BrowserContext* context) const override; | 53 content::BrowserContext* context) const override; |
| 51 | 54 |
| 52 // A factory function for overriding the way the SyncClient is created. | 55 // A factory function for overriding the way the SyncClient is created. |
| 53 // This is a raw pointer so it can be statically initialized. | 56 // This is a raw pointer so it can be statically initialized. |
| 54 static SyncClientFactory* client_factory_; | 57 static SyncClientFactory* client_factory_; |
| 55 | 58 |
| 56 DISALLOW_COPY_AND_ASSIGN(ProfileSyncServiceFactory); | 59 DISALLOW_COPY_AND_ASSIGN(ProfileSyncServiceFactory); |
| 57 }; | 60 }; |
| 58 | 61 |
| 59 #endif // CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_FACTORY_H_ | 62 #endif // CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_FACTORY_H_ |
| OLD | NEW |