| 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 CHROME_BROWSER_INVALIDATION_INVALIDATION_LOGGER_H_ | 5 #ifndef CHROME_BROWSER_INVALIDATION_INVALIDATION_LOGGER_H_ |
| 6 #define CHROME_BROWSER_INVALIDATION_INVALIDATION_LOGGER_H_ | 6 #define CHROME_BROWSER_INVALIDATION_INVALIDATION_LOGGER_H_ |
| 7 | 7 |
| 8 #include <map> |
| 8 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 9 #include "base/observer_list.h" | 10 #include "base/observer_list.h" |
| 11 #include "sync/notifier/invalidation_util.h" |
| 10 #include "sync/notifier/invalidator_state.h" | 12 #include "sync/notifier/invalidator_state.h" |
| 11 | 13 |
| 12 namespace base { | 14 namespace base { |
| 13 class DictionaryValue; | 15 class DictionaryValue; |
| 14 } // namespace base | 16 } // namespace base |
| 15 | 17 |
| 16 namespace syncer { | 18 namespace syncer { |
| 19 class InvalidationHandler; |
| 17 class ObjectIdInvalidationMap; | 20 class ObjectIdInvalidationMap; |
| 18 } | 21 } // namespace syncer |
| 19 | 22 |
| 20 namespace invalidation { | 23 namespace invalidation { |
| 21 class InvalidationLoggerObserver; | 24 class InvalidationLoggerObserver; |
| 22 | 25 |
| 23 class InvalidationLogger { | 26 class InvalidationLogger { |
| 24 public: | 27 public: |
| 25 // Pass through to any registered InvalidationLoggerObservers. | 28 // Pass through to any registered InvalidationLoggerObservers. |
| 26 // We will do local logging here too. | 29 // We will do local logging here too. |
| 27 void OnRegistration(const base::DictionaryValue& details); | 30 void OnRegistration(const base::DictionaryValue& details); |
| 28 void OnUnregistration(const base::DictionaryValue& details); | 31 void OnUnregistration(const base::DictionaryValue& details); |
| 29 void OnStateChange(const syncer::InvalidatorState& newState); | 32 void OnStateChange(const syncer::InvalidatorState& newState); |
| 30 void OnUpdateIds(const base::DictionaryValue& details); | 33 void OnUpdateIds(std::map<std::string, syncer::ObjectIdSet> updatedIds); |
| 31 void OnDebugMessage(const base::DictionaryValue& details); | 34 void OnDebugMessage(const base::DictionaryValue& details); |
| 32 void OnInvalidation(const syncer::ObjectIdInvalidationMap& details); | 35 void OnInvalidation(const syncer::ObjectIdInvalidationMap& details); |
| 33 | 36 |
| 34 void EmitContent(); | 37 void EmitContent(); |
| 35 | 38 |
| 36 InvalidationLogger(); | 39 InvalidationLogger(); |
| 37 ~InvalidationLogger(); | 40 ~InvalidationLogger(); |
| 38 | 41 |
| 39 void RegisterForDebug(InvalidationLoggerObserver* debug_observer); | 42 void RegisterForDebug(InvalidationLoggerObserver* debug_observer); |
| 40 void UnregisterForDebug(InvalidationLoggerObserver* debug_observer); | 43 void UnregisterForDebug(InvalidationLoggerObserver* debug_observer); |
| 41 | 44 |
| 42 private: | 45 private: |
| 43 void EmitState(); | 46 void EmitState(); |
| 44 // The list of every observer currently listening for notifications. | 47 // The list of every observer currently listening for notifications. |
| 48 void EmitUpdatedIds(); |
| 45 ObserverList<InvalidationLoggerObserver> observer_list_; | 49 ObserverList<InvalidationLoggerObserver> observer_list_; |
| 46 // The last InvalidatorState updated by the InvalidatorService. | 50 // The last InvalidatorState updated by the InvalidatorService. |
| 47 syncer::InvalidatorState last_invalidator_state_; | 51 syncer::InvalidatorState last_invalidator_state_; |
| 52 std::map<std::string, syncer::ObjectIdSet> latest_ids_; |
| 48 }; | 53 }; |
| 49 | 54 |
| 50 } // namespace invalidation | 55 } // namespace invalidation |
| 51 #endif // CHROME_BROWSER_INVALIDATION_INVALIDATION_LOGGER_H_ | 56 #endif // CHROME_BROWSER_INVALIDATION_INVALIDATION_LOGGER_H_ |
| OLD | NEW |