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