Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(978)

Side by Side Diff: chrome/browser/ui/webui/invalidations_message_handler.h

Issue 159773006: [invalidations] Added table with registered objectsIds (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@about_invalidations_clean
Patch Set: Change constness of iterators for android clang Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/values.h" 10 #include "base/values.h"
11 #include "chrome/browser/invalidation/invalidation_logger_observer.h" 11 #include "chrome/browser/invalidation/invalidation_logger_observer.h"
12 #include "content/public/browser/web_ui_message_handler.h" 12 #include "content/public/browser/web_ui_message_handler.h"
13 #include "sync/notifier/invalidation_util.h"
13 14
14 class Profile; 15 class Profile;
15 16
16 namespace invalidation { 17 namespace invalidation {
17 class InvalidationLogger; 18 class InvalidationLogger;
18 } // namespace invalidation 19 } // namespace invalidation
19 20
21 namespace syncer {
22 class InvalidationHandler;
23 } // namespace syncer
24
20 // The implementation for the chrome://invalidations page. 25 // The implementation for the chrome://invalidations page.
21 class InvalidationsMessageHandler 26 class InvalidationsMessageHandler
22 : public content::WebUIMessageHandler, 27 : public content::WebUIMessageHandler,
23 public invalidation::InvalidationLoggerObserver { 28 public invalidation::InvalidationLoggerObserver {
24 public: 29 public:
25 InvalidationsMessageHandler(); 30 InvalidationsMessageHandler();
26 virtual ~InvalidationsMessageHandler(); 31 virtual ~InvalidationsMessageHandler();
27 32
28 // Implementation of InvalidationLoggerObserver 33 // Implementation of InvalidationLoggerObserver.
29 virtual void OnRegistration(const base::DictionaryValue& details) OVERRIDE; 34 virtual void OnRegistration(const base::DictionaryValue& details) OVERRIDE;
30 virtual void OnUnregistration(const base::DictionaryValue& details) OVERRIDE; 35 virtual void OnUnregistration(const base::DictionaryValue& details) OVERRIDE;
31 virtual void OnStateChange(const syncer::InvalidatorState& newState) OVERRIDE; 36 virtual void OnStateChange(const syncer::InvalidatorState& new_state)
32 virtual void OnUpdateIds(const base::DictionaryValue& details) OVERRIDE; 37 OVERRIDE;
38 virtual void OnUpdateIds(const std::string& handler_name,
39 const syncer::ObjectIdSet& ids_set) OVERRIDE;
33 virtual void OnDebugMessage(const base::DictionaryValue& details) OVERRIDE; 40 virtual void OnDebugMessage(const base::DictionaryValue& details) OVERRIDE;
34 virtual void OnInvalidation( 41 virtual void OnInvalidation(
35 const syncer::ObjectIdInvalidationMap& newInvalidations) OVERRIDE; 42 const syncer::ObjectIdInvalidationMap& new_invalidations) OVERRIDE;
36 43
37 // Implementation of WebUIMessageHandler 44 // Implementation of WebUIMessageHandler.
38 virtual void RegisterMessages() OVERRIDE; 45 virtual void RegisterMessages() OVERRIDE;
39 46
47 // Triggers the logger to send the current state and objects ids.
40 void UpdateContent(const base::ListValue* args); 48 void UpdateContent(const base::ListValue* args);
49
50 // Called by the javascript whenever the page is ready to receive messages.
41 void UIReady(const base::ListValue* args); 51 void UIReady(const base::ListValue* args);
42 52
43 private: 53 private:
54 // Transforms a set to a ListValue in order to be automatically
55 // transformed to a JavaScript array of objects.
56 scoped_ptr<base::ListValue> ObjectIdSetToList(
57 const syncer::ObjectIdSet& ids_set);
58
44 // The pointer to the internal InvalidatorService InvalidationLogger. 59 // The pointer to the internal InvalidatorService InvalidationLogger.
45 // 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
46 // register ourselves as Observers for any notifications. 61 // register ourselves as Observers for any notifications.
47 invalidation::InvalidationLogger* logger_; 62 invalidation::InvalidationLogger* logger_;
48 // Check to see if we are already registered as an observer 63
49 bool isRegistered;
50 DISALLOW_COPY_AND_ASSIGN(InvalidationsMessageHandler); 64 DISALLOW_COPY_AND_ASSIGN(InvalidationsMessageHandler);
51 }; 65 };
52 66
53 #endif // CHROME_BROWSER_UI_WEBUI_INVALIDATIONS_MESSAGE_HANDLER_H_ 67 #endif // CHROME_BROWSER_UI_WEBUI_INVALIDATIONS_MESSAGE_HANDLER_H_
OLDNEW
« no previous file with comments | « chrome/browser/sync/glue/sync_backend_host_impl.cc ('k') | chrome/browser/ui/webui/invalidations_message_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698