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_UI_WEBUI_INVALIDATIONS_MESSAGE_HANDLER_H_ | 5 #ifndef CHROME_BROWSER_UI_WEBUI_INVALIDATIONS_MESSAGE_HANDLER_H_ |
6 #define CHROME_BROWSER_UI_WEBUI_INVALIDATIONS_MESSAGE_HANDLER_H_ | 6 #define CHROME_BROWSER_UI_WEBUI_INVALIDATIONS_MESSAGE_HANDLER_H_ |
7 | 7 |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
(...skipping 11 matching lines...) Expand all Loading... |
22 namespace syncer { | 22 namespace syncer { |
23 class InvalidationHandler; | 23 class InvalidationHandler; |
24 } // namespace syncer | 24 } // namespace syncer |
25 | 25 |
26 // The implementation for the chrome://invalidations page. | 26 // The implementation for the chrome://invalidations page. |
27 class InvalidationsMessageHandler | 27 class InvalidationsMessageHandler |
28 : public content::WebUIMessageHandler, | 28 : public content::WebUIMessageHandler, |
29 public invalidation::InvalidationLoggerObserver { | 29 public invalidation::InvalidationLoggerObserver { |
30 public: | 30 public: |
31 InvalidationsMessageHandler(); | 31 InvalidationsMessageHandler(); |
32 virtual ~InvalidationsMessageHandler(); | 32 ~InvalidationsMessageHandler() override; |
33 | 33 |
34 // Implementation of InvalidationLoggerObserver. | 34 // Implementation of InvalidationLoggerObserver. |
35 virtual void OnRegistrationChange( | 35 void OnRegistrationChange( |
36 const std::multiset<std::string>& registered_handlers) override; | 36 const std::multiset<std::string>& registered_handlers) override; |
37 virtual void OnStateChange(const syncer::InvalidatorState& new_state, | 37 void OnStateChange(const syncer::InvalidatorState& new_state, |
38 const base::Time& last_change_timestamp) | 38 const base::Time& last_change_timestamp) override; |
39 override; | 39 void OnUpdateIds(const std::string& handler_name, |
40 virtual void OnUpdateIds(const std::string& handler_name, | 40 const syncer::ObjectIdCountMap& ids_set) override; |
41 const syncer::ObjectIdCountMap& ids_set) override; | 41 void OnDebugMessage(const base::DictionaryValue& details) override; |
42 virtual void OnDebugMessage(const base::DictionaryValue& details) override; | 42 void OnInvalidation( |
43 virtual void OnInvalidation( | |
44 const syncer::ObjectIdInvalidationMap& new_invalidations) override; | 43 const syncer::ObjectIdInvalidationMap& new_invalidations) override; |
45 virtual void OnDetailedStatus(const base::DictionaryValue& network_details) | 44 void OnDetailedStatus(const base::DictionaryValue& network_details) override; |
46 override; | |
47 | 45 |
48 // Implementation of WebUIMessageHandler. | 46 // Implementation of WebUIMessageHandler. |
49 virtual void RegisterMessages() override; | 47 void RegisterMessages() override; |
50 | 48 |
51 // Triggers the logger to send the current state and objects ids. | 49 // Triggers the logger to send the current state and objects ids. |
52 void UpdateContent(const base::ListValue* args); | 50 void UpdateContent(const base::ListValue* args); |
53 | 51 |
54 // Called by the javascript whenever the page is ready to receive messages. | 52 // Called by the javascript whenever the page is ready to receive messages. |
55 void UIReady(const base::ListValue* args); | 53 void UIReady(const base::ListValue* args); |
56 | 54 |
57 // Calls the InvalidationService for any internal details. | 55 // Calls the InvalidationService for any internal details. |
58 void HandleRequestDetailedStatus(const base::ListValue* args); | 56 void HandleRequestDetailedStatus(const base::ListValue* args); |
59 | 57 |
60 private: | 58 private: |
61 // The pointer to the internal InvalidatorService InvalidationLogger. | 59 // The pointer to the internal InvalidatorService InvalidationLogger. |
62 // Used to get the information necessary to display to the JS and to | 60 // Used to get the information necessary to display to the JS and to |
63 // register ourselves as Observers for any notifications. | 61 // register ourselves as Observers for any notifications. |
64 invalidation::InvalidationLogger* logger_; | 62 invalidation::InvalidationLogger* logger_; |
65 | 63 |
66 base::WeakPtrFactory<InvalidationsMessageHandler> weak_ptr_factory_; | 64 base::WeakPtrFactory<InvalidationsMessageHandler> weak_ptr_factory_; |
67 | 65 |
68 DISALLOW_COPY_AND_ASSIGN(InvalidationsMessageHandler); | 66 DISALLOW_COPY_AND_ASSIGN(InvalidationsMessageHandler); |
69 }; | 67 }; |
70 | 68 |
71 #endif // CHROME_BROWSER_UI_WEBUI_INVALIDATIONS_MESSAGE_HANDLER_H_ | 69 #endif // CHROME_BROWSER_UI_WEBUI_INVALIDATIONS_MESSAGE_HANDLER_H_ |
OLD | NEW |