[email protected] | 47b89656 | 2012-08-22 23:55:15 | [diff] [blame^] | 1 | // Copyright (c) 2012 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_SYNC_INVALIDATION_FRONTEND_H_ |
| 6 | #define CHROME_BROWSER_SYNC_INVALIDATION_FRONTEND_H_ |
| 7 | |
| 8 | #include "sync/notifier/invalidation_util.h" |
| 9 | |
| 10 | namespace syncer { |
| 11 | class SyncNotifierObserver; |
| 12 | } // namespace syncer |
| 13 | |
| 14 | // Interface for classes that handle invalidation registrations and send out |
| 15 | // invalidations to register handlers. |
| 16 | class InvalidationFrontend { |
| 17 | public: |
| 18 | // Starts sending notifications to |handler|. |handler| must not be NULL, |
| 19 | // and it must not already be registered. |
| 20 | // |
| 21 | // Handler registrations are persisted across restarts of sync. |
| 22 | virtual void RegisterInvalidationHandler( |
| 23 | syncer::SyncNotifierObserver* handler) = 0; |
| 24 | |
| 25 | // Updates the set of ObjectIds associated with |handler|. |handler| must |
| 26 | // not be NULL, and must already be registered. An ID must be registered for |
| 27 | // at most one handler. |
| 28 | // |
| 29 | // Registered IDs are persisted across restarts of sync. |
| 30 | virtual void UpdateRegisteredInvalidationIds( |
| 31 | syncer::SyncNotifierObserver* handler, |
| 32 | const syncer::ObjectIdSet& ids) = 0; |
| 33 | |
| 34 | // Stops sending notifications to |handler|. |handler| must not be NULL, and |
| 35 | // it must already be registered. Note that this doesn't unregister the IDs |
| 36 | // associated with |handler|. |
| 37 | // |
| 38 | // Handler registrations are persisted across restarts of sync. |
| 39 | virtual void UnregisterInvalidationHandler( |
| 40 | syncer::SyncNotifierObserver* handler) = 0; |
| 41 | |
| 42 | protected: |
| 43 | virtual ~InvalidationFrontend() { } |
| 44 | }; |
| 45 | |
| 46 | #endif // CHROME_BROWSER_SYNC_INVALIDATION_FRONTEND_H_ |