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

Unified Diff: chrome/browser/ui/webui/sync_internals_message_handler.h

Issue 162283002: Move towards event-driven JS on about:sync (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Another reupload 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/webui/sync_internals_message_handler.h
diff --git a/chrome/browser/ui/webui/sync_internals_message_handler.h b/chrome/browser/ui/webui/sync_internals_message_handler.h
index 5b652d5627ade67284270dda9fa7a8503d0bb108..8253acdeecca03c15e380ab34414f56bb0ba4aa6 100644
--- a/chrome/browser/ui/webui/sync_internals_message_handler.h
+++ b/chrome/browser/ui/webui/sync_internals_message_handler.h
@@ -11,6 +11,7 @@
#include "base/compiler_specific.h"
#include "base/memory/weak_ptr.h"
#include "base/values.h"
+#include "chrome/browser/sync/profile_sync_service_observer.h"
#include "content/public/browser/web_ui_message_handler.h"
#include "sync/js/js_controller.h"
#include "sync/js/js_event_handler.h"
@@ -22,16 +23,22 @@ class ProfileSyncService;
class SyncInternalsMessageHandler
: public content::WebUIMessageHandler,
public syncer::JsEventHandler,
- public syncer::JsReplyHandler {
+ public syncer::JsReplyHandler,
+ public ProfileSyncServiceObserver {
public:
SyncInternalsMessageHandler();
virtual ~SyncInternalsMessageHandler();
virtual void RegisterMessages() OVERRIDE;
+ // Forwards requests to the JsController.
void ForwardToJsController(const std::string& name, const base::ListValue*);
- void OnGetAboutInfo(const base::ListValue*);
- void OnGetListOfTypes(const base::ListValue*);
+
+ // Fires an event to send updated info back to the page.
+ void HandleRequestUpdatedAboutInfo(const base::ListValue* args);
+
+ // Fires and event to send the list of types back to the page.
+ void HandleRequestListOfTypes(const base::ListValue* args);
// syncer::JsEventHandler implementation.
virtual void HandleJsEvent(
@@ -43,8 +50,17 @@ class SyncInternalsMessageHandler
const std::string& name,
const syncer::JsArgList& args) OVERRIDE;
+ // ProfileSyncServiceObserver implementation.
+ virtual void OnStateChanged() OVERRIDE;
+
private:
+ // Helper function to register JsController function callbacks.
void RegisterJsControllerCallback(const std::string& name);
+
+ // Fetches updated aboutInfo and sends it to the page in the form of an
+ // onAboutInfoUpdated event.
+ void SendAboutInfo();
+
ProfileSyncService* GetProfileSyncService();
base::WeakPtr<syncer::JsController> js_controller_;
« no previous file with comments | « chrome/browser/ui/webui/sync_internals_browsertest.js ('k') | chrome/browser/ui/webui/sync_internals_message_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698