| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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_EXTENSIONS_API_PUSH_MESSAGING_PUSH_MESSAGING_INVALIDATION
_HANDLER_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_PUSH_MESSAGING_PUSH_MESSAGING_INVALIDATION
_HANDLER_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_API_PUSH_MESSAGING_PUSH_MESSAGING_INVALIDATION
_HANDLER_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_API_PUSH_MESSAGING_PUSH_MESSAGING_INVALIDATION
_HANDLER_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 // received. | 29 // received. |
| 30 class PushMessagingInvalidationHandler : public PushMessagingInvalidationMapper, | 30 class PushMessagingInvalidationHandler : public PushMessagingInvalidationMapper, |
| 31 public syncer::InvalidationHandler { | 31 public syncer::InvalidationHandler { |
| 32 public: | 32 public: |
| 33 // |service| and |delegate| must remain valid for the lifetime of this object. | 33 // |service| and |delegate| must remain valid for the lifetime of this object. |
| 34 // |extension_ids| is the set of extension IDs for which push messaging is | 34 // |extension_ids| is the set of extension IDs for which push messaging is |
| 35 // enabled. | 35 // enabled. |
| 36 PushMessagingInvalidationHandler( | 36 PushMessagingInvalidationHandler( |
| 37 invalidation::InvalidationService* service, | 37 invalidation::InvalidationService* service, |
| 38 PushMessagingInvalidationHandlerDelegate* delegate); | 38 PushMessagingInvalidationHandlerDelegate* delegate); |
| 39 virtual ~PushMessagingInvalidationHandler(); | 39 ~PushMessagingInvalidationHandler() override; |
| 40 | 40 |
| 41 // PushMessagingInvalidationMapper implementation. | 41 // PushMessagingInvalidationMapper implementation. |
| 42 virtual void SuppressInitialInvalidationsForExtension( | 42 void SuppressInitialInvalidationsForExtension( |
| 43 const std::string& extension_id) override; | 43 const std::string& extension_id) override; |
| 44 virtual void RegisterExtension(const std::string& extension_id) override; | 44 void RegisterExtension(const std::string& extension_id) override; |
| 45 virtual void UnregisterExtension(const std::string& extension_id) override; | 45 void UnregisterExtension(const std::string& extension_id) override; |
| 46 | 46 |
| 47 // InvalidationHandler implementation. | 47 // InvalidationHandler implementation. |
| 48 virtual void OnInvalidatorStateChange( | 48 void OnInvalidatorStateChange(syncer::InvalidatorState state) override; |
| 49 syncer::InvalidatorState state) override; | 49 void OnIncomingInvalidation( |
| 50 virtual void OnIncomingInvalidation( | |
| 51 const syncer::ObjectIdInvalidationMap& invalidation_map) override; | 50 const syncer::ObjectIdInvalidationMap& invalidation_map) override; |
| 52 virtual std::string GetOwnerName() const override; | 51 std::string GetOwnerName() const override; |
| 53 | 52 |
| 54 const std::set<std::string>& GetRegisteredExtensionsForTest() const { | 53 const std::set<std::string>& GetRegisteredExtensionsForTest() const { |
| 55 return registered_extensions_; | 54 return registered_extensions_; |
| 56 } | 55 } |
| 57 | 56 |
| 58 private: | 57 private: |
| 59 void UpdateRegistrations(); | 58 void UpdateRegistrations(); |
| 60 | 59 |
| 61 base::ThreadChecker thread_checker_; | 60 base::ThreadChecker thread_checker_; |
| 62 invalidation::InvalidationService* const service_; | 61 invalidation::InvalidationService* const service_; |
| 63 std::set<std::string> registered_extensions_; | 62 std::set<std::string> registered_extensions_; |
| 64 syncer::ObjectIdSet suppressed_ids_; | 63 syncer::ObjectIdSet suppressed_ids_; |
| 65 PushMessagingInvalidationHandlerDelegate* const delegate_; | 64 PushMessagingInvalidationHandlerDelegate* const delegate_; |
| 66 std::map<invalidation::ObjectId, | 65 std::map<invalidation::ObjectId, |
| 67 int64, | 66 int64, |
| 68 syncer::ObjectIdLessThan> max_object_version_map_; | 67 syncer::ObjectIdLessThan> max_object_version_map_; |
| 69 | 68 |
| 70 DISALLOW_COPY_AND_ASSIGN(PushMessagingInvalidationHandler); | 69 DISALLOW_COPY_AND_ASSIGN(PushMessagingInvalidationHandler); |
| 71 }; | 70 }; |
| 72 | 71 |
| 73 } // namespace extensions | 72 } // namespace extensions |
| 74 | 73 |
| 75 #endif // CHROME_BROWSER_EXTENSIONS_API_PUSH_MESSAGING_PUSH_MESSAGING_INVALIDAT
ION_HANDLER_H_ | 74 #endif // CHROME_BROWSER_EXTENSIONS_API_PUSH_MESSAGING_PUSH_MESSAGING_INVALIDAT
ION_HANDLER_H_ |
| OLD | NEW |