OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 COMPONENTS_INVALIDATION_INVALIDATION_SERVICE_H_ | 5 #ifndef COMPONENTS_INVALIDATION_INVALIDATION_SERVICE_H_ |
6 #define COMPONENTS_INVALIDATION_INVALIDATION_SERVICE_H_ | 6 #define COMPONENTS_INVALIDATION_INVALIDATION_SERVICE_H_ |
7 | 7 |
8 #include "base/callback_forward.h" | 8 #include "base/callback_forward.h" |
9 #include "components/keyed_service/core/keyed_service.h" | |
10 #include "sync/internal_api/public/base/invalidator_state.h" | 9 #include "sync/internal_api/public/base/invalidator_state.h" |
11 #include "sync/notifier/invalidation_util.h" | 10 #include "sync/notifier/invalidation_util.h" |
12 | 11 |
13 class IdentityProvider; | 12 class IdentityProvider; |
14 | 13 |
15 namespace syncer { | 14 namespace syncer { |
16 class InvalidationHandler; | 15 class InvalidationHandler; |
17 } // namespace syncer | 16 } // namespace syncer |
18 | 17 |
19 namespace invalidation { | 18 namespace invalidation { |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 // | 56 // |
58 // It is an error to have registered handlers when an | 57 // It is an error to have registered handlers when an |
59 // InvalidationFrontend is shut down; clients must ensure that they | 58 // InvalidationFrontend is shut down; clients must ensure that they |
60 // unregister themselves before then. (Depending on the | 59 // unregister themselves before then. (Depending on the |
61 // InvalidationFrontend, shutdown may be equivalent to destruction, or | 60 // InvalidationFrontend, shutdown may be equivalent to destruction, or |
62 // a separate function call like Shutdown()). | 61 // a separate function call like Shutdown()). |
63 // | 62 // |
64 // NOTE(akalin): Invalidations that come in during browser shutdown may get | 63 // NOTE(akalin): Invalidations that come in during browser shutdown may get |
65 // dropped. This won't matter once we have an Acknowledge API, though: see | 64 // dropped. This won't matter once we have an Acknowledge API, though: see |
66 // http://crbug.com/78462 and http://crbug.com/124149. | 65 // http://crbug.com/78462 and http://crbug.com/124149. |
67 // | 66 class InvalidationService { |
68 // This class inherits from ProfileKeyedService to make it possible to correctly | |
69 // cast from various InvalidationService implementations to ProfileKeyedService | |
70 // in InvalidationServiceFactory. | |
71 class InvalidationService : public KeyedService { | |
72 public: | 67 public: |
| 68 virtual ~InvalidationService() {} |
| 69 |
73 // Starts sending notifications to |handler|. |handler| must not be NULL, | 70 // Starts sending notifications to |handler|. |handler| must not be NULL, |
74 // and it must not already be registered. | 71 // and it must not already be registered. |
75 // | 72 // |
76 // Handler registrations are persisted across restarts of sync. | 73 // Handler registrations are persisted across restarts of sync. |
77 virtual void RegisterInvalidationHandler( | 74 virtual void RegisterInvalidationHandler( |
78 syncer::InvalidationHandler* handler) = 0; | 75 syncer::InvalidationHandler* handler) = 0; |
79 | 76 |
80 // Updates the set of ObjectIds associated with |handler|. |handler| must | 77 // Updates the set of ObjectIds associated with |handler|. |handler| must |
81 // not be NULL, and must already be registered. An ID must be registered for | 78 // not be NULL, and must already be registered. An ID must be registered for |
82 // at most one handler. | 79 // at most one handler. |
(...skipping 22 matching lines...) Expand all Loading... |
105 | 102 |
106 // Return the logger used to debug invalidations | 103 // Return the logger used to debug invalidations |
107 virtual InvalidationLogger* GetInvalidationLogger() = 0; | 104 virtual InvalidationLogger* GetInvalidationLogger() = 0; |
108 | 105 |
109 // Triggers requests of internal status. | 106 // Triggers requests of internal status. |
110 virtual void RequestDetailedStatus( | 107 virtual void RequestDetailedStatus( |
111 base::Callback<void(const base::DictionaryValue&)> post_caller) const = 0; | 108 base::Callback<void(const base::DictionaryValue&)> post_caller) const = 0; |
112 | 109 |
113 // Returns the identity provider. | 110 // Returns the identity provider. |
114 virtual IdentityProvider* GetIdentityProvider() = 0; | 111 virtual IdentityProvider* GetIdentityProvider() = 0; |
115 | |
116 protected: | |
117 virtual ~InvalidationService() { } | |
118 }; | 112 }; |
119 | 113 |
120 } // namespace invalidation | 114 } // namespace invalidation |
121 | 115 |
122 #endif // COMPONENTS_INVALIDATION_INVALIDATION_SERVICE_H_ | 116 #endif // COMPONENTS_INVALIDATION_INVALIDATION_SERVICE_H_ |
OLD | NEW |