Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(328)

Unified Diff: chrome/browser/invalidation/invalidation_service_factory.h

Issue 15580002: Make use of InvalidationService (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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);
};

Powered by Google App Engine
This is Rietveld 408576698