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

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

Issue 290023003: sync: Add UI code for per type debug counters (Closed) Base URL: https://chromium.googlesource.com/chromium/src
Patch Set: Update comment and rebase Created 6 years, 7 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
« no previous file with comments | « chrome/browser/ui/webui/DEPS ('k') | chrome/browser/ui/webui/sync_internals_message_handler.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 833a4fcebc430760b55b8dd610b23a7711879d9f..675594a9b2a7e44b305c1409dc9fcced9ddd316f 100644
--- a/chrome/browser/ui/webui/sync_internals_message_handler.h
+++ b/chrome/browser/ui/webui/sync_internals_message_handler.h
@@ -15,17 +15,18 @@
#include "chrome/browser/sync/profile_sync_service_observer.h"
#include "chrome/browser/sync/protocol_event_observer.h"
#include "content/public/browser/web_ui_message_handler.h"
+#include "sync/internal_api/public/sessions/type_debug_info_observer.h"
#include "sync/js/js_controller.h"
#include "sync/js/js_event_handler.h"
class ProfileSyncService;
// The implementation for the chrome://sync-internals page.
-class SyncInternalsMessageHandler
- : public content::WebUIMessageHandler,
- public syncer::JsEventHandler,
- public ProfileSyncServiceObserver,
- public browser_sync::ProtocolEventObserver {
+class SyncInternalsMessageHandler : public content::WebUIMessageHandler,
+ public syncer::JsEventHandler,
+ public ProfileSyncServiceObserver,
+ public browser_sync::ProtocolEventObserver,
+ public syncer::TypeDebugInfoObserver {
public:
SyncInternalsMessageHandler();
virtual ~SyncInternalsMessageHandler();
@@ -35,6 +36,9 @@ class SyncInternalsMessageHandler
// Sets up observers to receive events and forward them to the UI.
void HandleRegisterForEvents(const base::ListValue* args);
+ // Sets up observers to receive per-type counters and forward them to the UI.
+ void HandleRegisterForPerTypeCounters(const base::ListValue* args);
+
// Fires an event to send updated info back to the page.
void HandleRequestUpdatedAboutInfo(const base::ListValue* args);
@@ -58,6 +62,26 @@ class SyncInternalsMessageHandler
// ProtocolEventObserver implementation.
virtual void OnProtocolEvent(const syncer::ProtocolEvent& e) OVERRIDE;
+ // TypeDebugInfoObserver implementation.
+ virtual void OnCommitCountersUpdated(
+ syncer::ModelType type,
+ const syncer::CommitCounters& counters) OVERRIDE;
+ virtual void OnUpdateCountersUpdated(
+ syncer::ModelType type,
+ const syncer::UpdateCounters& counters) OVERRIDE;
+ virtual void OnStatusCountersUpdated(
+ syncer::ModelType type,
+ const syncer::StatusCounters& counters) OVERRIDE;
+
+ // Helper to emit counter updates.
+ //
+ // Used in implementation of On*CounterUpdated methods. Emits the given
+ // dictionary value with additional data to specify the model type and
+ // counter type.
+ void EmitCounterUpdate(syncer::ModelType type,
+ const std::string& counter_type,
+ scoped_ptr<base::DictionaryValue> value);
+
private:
// Fetches updated aboutInfo and sends it to the page in the form of an
// onAboutInfoUpdated event.
@@ -70,6 +94,10 @@ class SyncInternalsMessageHandler
// A flag used to prevent double-registration with ProfileSyncService.
bool is_registered_;
+ // A flag used to prevent double-registration as TypeDebugInfoObserver with
+ // ProfileSyncService.
+ bool is_registered_for_counters_;
+
base::WeakPtrFactory<SyncInternalsMessageHandler> weak_ptr_factory_;
DISALLOW_COPY_AND_ASSIGN(SyncInternalsMessageHandler);
« no previous file with comments | « chrome/browser/ui/webui/DEPS ('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