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.
5 #ifndef CHROME_BROWSER_UI_WEBUI_INVALIDATIONS_MESSAGE_HANDLER_H_
6 #define CHROME_BROWSER_UI_WEBUI_INVALIDATIONS_MESSAGE_HANDLER_H_
8 #include "base/compiler_specific.h"
9 #include "base/memory/scoped_ptr.h"
10 #include "base/values.h"
11 #include "chrome/browser/invalidation/invalidation_logger_observer.h"
12 #include "content/public/browser/web_ui_message_handler.h"
16 namespace invalidation
{
17 class InvalidationLogger
;
18 } // namespace invalidation
20 // The implementation for the chrome://invalidations page.
21 class InvalidationsMessageHandler
22 : public content::WebUIMessageHandler
,
23 public invalidation::InvalidationLoggerObserver
{
25 InvalidationsMessageHandler();
26 virtual ~InvalidationsMessageHandler();
28 // Implementation of InvalidationLoggerObserver
29 virtual void OnRegistration(const base::DictionaryValue
& details
) OVERRIDE
;
30 virtual void OnUnregistration(const base::DictionaryValue
& details
) OVERRIDE
;
31 virtual void OnStateChange(const syncer::InvalidatorState
& newState
) OVERRIDE
;
32 virtual void OnUpdateIds(const base::DictionaryValue
& details
) OVERRIDE
;
33 virtual void OnDebugMessage(const base::DictionaryValue
& details
) OVERRIDE
;
34 virtual void OnInvalidation(
35 const syncer::ObjectIdInvalidationMap
& newInvalidations
) OVERRIDE
;
37 // Implementation of WebUIMessageHandler
38 virtual void RegisterMessages() OVERRIDE
;
40 void UpdateContent(const base::ListValue
* args
);
41 void UIReady(const base::ListValue
* args
);
44 // The pointer to the internal InvalidatorService InvalidationLogger.
45 // Used to get the information necessary to display to the JS and to
46 // register ourselves as Observers for any notifications.
47 invalidation::InvalidationLogger
* logger_
;
48 // Check to see if we are already registered as an observer
50 DISALLOW_COPY_AND_ASSIGN(InvalidationsMessageHandler
);
53 #endif // CHROME_BROWSER_UI_WEBUI_INVALIDATIONS_MESSAGE_HANDLER_H_