Index: chrome/browser/invalidation/invalidation_service_factory.h |
diff --git a/chrome/browser/invalidation/invalidation_service_factory.h b/chrome/browser/invalidation/invalidation_service_factory.h |
index da6900a217b363011c42b20408cb868982aeaff1..fa2828af79b88bb3f74312001f948f68435e66ea 100644 |
--- a/chrome/browser/invalidation/invalidation_service_factory.h |
+++ b/chrome/browser/invalidation/invalidation_service_factory.h |
@@ -9,15 +9,22 @@ |
#include "base/memory/singleton.h" |
#include "components/browser_context_keyed_service/browser_context_keyed_service_factory.h" |
+namespace user_prefs { |
+class PrefRegistrySyncable; |
+} |
+ |
namespace syncer { |
class Invalidator; |
} |
-class InvalidationFrontend; |
class Profile; |
namespace invalidation { |
+class InvalidationService; |
+class P2PInvalidationService; |
+class FakeInvalidationService; |
+ |
// A BrowserContextKeyedServiceFactory to construct InvalidationServices. The |
// implementation of the InvalidationService may be completely different on |
// different platforms; this class should help to hide this complexity. It also |
@@ -25,16 +32,18 @@ namespace invalidation { |
// on invalidations. |
class InvalidationServiceFactory : public BrowserContextKeyedServiceFactory { |
public: |
- // TODO(rlarocque): Re-enable this once InvalidationFrontend can extend |
- // BrowserContextKeyedService. |
- // static InvalidationFrontend* GetForProfile(Profile* profile); |
+ static InvalidationService* GetForProfile(Profile* profile); |
static InvalidationServiceFactory* GetInstance(); |
- static BrowserContextKeyedService* BuildP2PInvalidationServiceFor( |
- Profile* profile); |
- static BrowserContextKeyedService* BuildTestServiceInstanceFor( |
- Profile* profile); |
+ // A helper function to set this factory to return FakeInvalidationServices |
+ // instead of the default InvalidationService objects. |
+ void SetBuildOnlyFakeInvalidatorsForTest(bool test_mode_enabled); |
+ |
+ // These helper functions to set the factory to build a test-only type of |
+ // invalidator and return the instance immeidately. |
+ P2PInvalidationService* BuildAndUseP2PInvalidationServiceForTest( |
+ content::BrowserContext* context); |
private: |
friend struct DefaultSingletonTraits<InvalidationServiceFactory>; |
@@ -44,10 +53,12 @@ class InvalidationServiceFactory : public BrowserContextKeyedServiceFactory { |
// BrowserContextKeyedServiceFactory: |
virtual BrowserContextKeyedService* BuildServiceInstanceFor( |
- content::BrowserContext* profile) const OVERRIDE; |
- // TODO(rlarocque): Use this class, not InvalidatorStorage, to register |
- // for user prefs. |
- // virtual void RegisterUserPrefs(PrefRegistrySyncable* registry) OVERRIDE; |
+ content::BrowserContext* context) const OVERRIDE; |
+ virtual void RegisterUserPrefs( |
+ user_prefs::PrefRegistrySyncable* registry) OVERRIDE; |
+ |
+ // If true, this factory will return only FakeInvalidationService instances. |
+ bool build_fake_invalidators_; |
DISALLOW_COPY_AND_ASSIGN(InvalidationServiceFactory); |
}; |