OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 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 | 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_INVALIDATION_INVALIDATION_SERVICE_FACTORY_H_ | 5 #ifndef CHROME_BROWSER_INVALIDATION_INVALIDATION_SERVICE_FACTORY_H_ |
6 #define CHROME_BROWSER_INVALIDATION_INVALIDATION_SERVICE_FACTORY_H_ | 6 #define CHROME_BROWSER_INVALIDATION_INVALIDATION_SERVICE_FACTORY_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/memory/singleton.h" | 9 #include "base/memory/singleton.h" |
10 #include "components/browser_context_keyed_service/browser_context_keyed_service
_factory.h" | 10 #include "components/browser_context_keyed_service/browser_context_keyed_service
_factory.h" |
11 | 11 |
12 namespace syncer { | 12 namespace syncer { |
13 class Invalidator; | 13 class Invalidator; |
14 } | 14 } |
15 | 15 |
16 class InvalidationFrontend; | 16 class InvalidationFrontend; |
17 class Profile; | 17 class Profile; |
18 | 18 |
19 namespace invalidation { | 19 namespace invalidation { |
20 | 20 |
21 // A ProfileKeyedServiceFactory to construct InvalidationServices. The | 21 // A BrowserContextKeyedServiceFactory to construct InvalidationServices. The |
22 // implementation of the InvalidationService may be completely different on | 22 // implementation of the InvalidationService may be completely different on |
23 // different platforms; this class should help to hide this complexity. It also | 23 // different platforms; this class should help to hide this complexity. It also |
24 // exposes some factory methods that are useful for setting up tests that rely | 24 // exposes some factory methods that are useful for setting up tests that rely |
25 // on invalidations. | 25 // on invalidations. |
26 class InvalidationServiceFactory : public ProfileKeyedServiceFactory { | 26 class InvalidationServiceFactory : public BrowserContextKeyedServiceFactory { |
27 public: | 27 public: |
28 // TODO(rlarocque): Re-enable this once InvalidationFrontend can extend | 28 // TODO(rlarocque): Re-enable this once InvalidationFrontend can extend |
29 // ProfileKeyedService. | 29 // BrowserContextKeyedService. |
30 // static InvalidationFrontend* GetForProfile(Profile* profile); | 30 // static InvalidationFrontend* GetForProfile(Profile* profile); |
31 | 31 |
32 static InvalidationServiceFactory* GetInstance(); | 32 static InvalidationServiceFactory* GetInstance(); |
33 | 33 |
34 static ProfileKeyedService* BuildP2PInvalidationServiceFor(Profile* profile); | 34 static BrowserContextKeyedService* BuildP2PInvalidationServiceFor( |
35 static ProfileKeyedService* BuildTestServiceInstanceFor(Profile* profile); | 35 Profile* profile); |
| 36 static BrowserContextKeyedService* BuildTestServiceInstanceFor( |
| 37 Profile* profile); |
36 | 38 |
37 private: | 39 private: |
38 friend struct DefaultSingletonTraits<InvalidationServiceFactory>; | 40 friend struct DefaultSingletonTraits<InvalidationServiceFactory>; |
39 | 41 |
40 InvalidationServiceFactory(); | 42 InvalidationServiceFactory(); |
41 virtual ~InvalidationServiceFactory(); | 43 virtual ~InvalidationServiceFactory(); |
42 | 44 |
43 // ProfileKeyedServiceFactory: | 45 // BrowserContextKeyedServiceFactory: |
44 virtual ProfileKeyedService* BuildServiceInstanceFor( | 46 virtual BrowserContextKeyedService* BuildServiceInstanceFor( |
45 content::BrowserContext* profile) const OVERRIDE; | 47 content::BrowserContext* profile) const OVERRIDE; |
46 // TODO(rlarocque): Use this class, not InvalidatorStorage, to register | 48 // TODO(rlarocque): Use this class, not InvalidatorStorage, to register |
47 // for user prefs. | 49 // for user prefs. |
48 // virtual void RegisterUserPrefs(PrefRegistrySyncable* registry) OVERRIDE; | 50 // virtual void RegisterUserPrefs(PrefRegistrySyncable* registry) OVERRIDE; |
49 | 51 |
50 DISALLOW_COPY_AND_ASSIGN(InvalidationServiceFactory); | 52 DISALLOW_COPY_AND_ASSIGN(InvalidationServiceFactory); |
51 }; | 53 }; |
52 | 54 |
53 } // namespace invalidation | 55 } // namespace invalidation |
54 | 56 |
55 #endif // CHROME_BROWSER_INVALIDATION_INVALIDATION_SERVICE_FACTORY_H_ | 57 #endif // CHROME_BROWSER_INVALIDATION_INVALIDATION_SERVICE_FACTORY_H_ |
OLD | NEW |