invalidation_handler.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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
  3. // found in the LICENSE file.
  4. #ifndef COMPONENTS_INVALIDATION_PUBLIC_INVALIDATION_HANDLER_H_
  5. #define COMPONENTS_INVALIDATION_PUBLIC_INVALIDATION_HANDLER_H_
  6. #include <string>
  7. #include "components/invalidation/public/invalidation_export.h"
  8. #include "components/invalidation/public/invalidation_util.h"
  9. #include "components/invalidation/public/invalidator_state.h"
  10. namespace invalidation {
  11. class TopicInvalidationMap;
  12. class INVALIDATION_EXPORT InvalidationHandler {
  13. public:
  14. InvalidationHandler() = default;
  15. InvalidationHandler(const InvalidationHandler& other) = delete;
  16. InvalidationHandler& operator=(const InvalidationHandler& other) = delete;
  17. virtual ~InvalidationHandler() = default;
  18. // Called when the invalidator state changes.
  19. virtual void OnInvalidatorStateChange(InvalidatorState state) = 0;
  20. // Called when a invalidation is received. Note that this may be called
  21. // regardless of the current invalidator state.
  22. virtual void OnIncomingInvalidation(
  23. const TopicInvalidationMap& invalidation_map) = 0;
  24. // Returned value must be unique for the handlers using the same invalidation
  25. // service.
  26. virtual std::string GetOwnerName() const = 0;
  27. // Called on change of |client_id|. Client id is used to identify the
  28. // the invalidator. The id is only relevant to some handlers, e.g. Sync
  29. // where the reflection blocking logic is based on it.
  30. virtual void OnInvalidatorClientIdChange(const std::string& client_id);
  31. virtual bool IsPublicTopic(const Topic& topic) const;
  32. };
  33. } // namespace invalidation
  34. #endif // COMPONENTS_INVALIDATION_PUBLIC_INVALIDATION_HANDLER_H_