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

Side by Side Diff: chrome/browser/invalidation/invalidation_service_factory.h

Issue 327243003: Introduce ProfileInvalidationProvider wrapper for InvalidationService (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix clang compilation. Created 6 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_INVALIDATION_INVALIDATION_SERVICE_FACTORY_H_
6 #define CHROME_BROWSER_INVALIDATION_INVALIDATION_SERVICE_FACTORY_H_
7
8 #include "base/basictypes.h"
9 #include "base/memory/singleton.h"
10 #include "components/keyed_service/content/browser_context_keyed_service_factory .h"
11
12 namespace user_prefs {
13 class PrefRegistrySyncable;
14 }
15
16 namespace syncer {
17 class Invalidator;
18 }
19
20 class Profile;
21
22 namespace invalidation {
23
24 class FakeInvalidationService;
25 class InvalidationService;
26 class P2PInvalidationService;
27
28 // A BrowserContextKeyedServiceFactory to construct InvalidationServices. The
29 // implementation of the InvalidationService may be completely different on
30 // different platforms; this class should help to hide this complexity. It also
31 // exposes some factory methods that are useful for setting up tests that rely
32 // on invalidations.
33 class InvalidationServiceFactory : public BrowserContextKeyedServiceFactory {
34 public:
35 // Returns the InvalidationService for the given |profile|, lazily creating
36 // one first if required. If |profile| does not support invalidation
37 // (Chrome OS login profile, Chrome OS guest), returns NULL instead.
38 static InvalidationService* GetForProfile(Profile* profile);
39
40 static InvalidationServiceFactory* GetInstance();
41
42 // Switches service creation to go through |testing_factory| for all browser
43 // contexts.
44 void RegisterTestingFactory(TestingFactoryFunction testing_factory);
45
46 private:
47 friend class InvalidationServiceFactoryTestBase;
48 friend struct DefaultSingletonTraits<InvalidationServiceFactory>;
49
50 InvalidationServiceFactory();
51 virtual ~InvalidationServiceFactory();
52
53 // BrowserContextKeyedServiceFactory:
54 virtual KeyedService* BuildServiceInstanceFor(
55 content::BrowserContext* context) const OVERRIDE;
56 virtual void RegisterProfilePrefs(
57 user_prefs::PrefRegistrySyncable* registry) OVERRIDE;
58
59 TestingFactoryFunction testing_factory_;
60
61 DISALLOW_COPY_AND_ASSIGN(InvalidationServiceFactory);
62 };
63
64 } // namespace invalidation
65
66 #endif // CHROME_BROWSER_INVALIDATION_INVALIDATION_SERVICE_FACTORY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698