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

Unified Diff: chrome/browser/ui/webui/sync_file_system_internals/dump_database_handler.cc

Issue 107743002: Add 'Dump Database' tab to syncfs-internals (only for v2 for now) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: regular -> Regular, added app_id Created 7 years 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_file_system_internals/dump_database_handler.cc
diff --git a/chrome/browser/ui/webui/sync_file_system_internals/dump_database_handler.cc b/chrome/browser/ui/webui/sync_file_system_internals/dump_database_handler.cc
new file mode 100644
index 0000000000000000000000000000000000000000..92ac0ee089258c5b94a8639b5a8b2dfd2b21a48c
--- /dev/null
+++ b/chrome/browser/ui/webui/sync_file_system_internals/dump_database_handler.cc
@@ -0,0 +1,35 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/ui/webui/sync_file_system_internals/dump_database_handler.h"
+
+#include "chrome/browser/profiles/profile.h"
+#include "chrome/browser/sync_file_system/sync_file_system_service.h"
+#include "chrome/browser/sync_file_system/sync_file_system_service_factory.h"
+#include "content/public/browser/web_ui.h"
+#include "content/public/browser/web_ui_data_source.h"
+
+using sync_file_system::SyncFileSystemServiceFactory;
+
+namespace syncfs_internals {
+
+DumpDatabaseHandler::DumpDatabaseHandler(Profile* profile)
+ : profile_(profile) {}
+DumpDatabaseHandler::~DumpDatabaseHandler() {}
+
+void DumpDatabaseHandler::RegisterMessages() {
+ web_ui()->RegisterMessageCallback(
+ "getDatabaseDump",
+ base::Bind(&DumpDatabaseHandler::GetDatabaseDump,
+ base::Unretained(this)));
+}
+
+void DumpDatabaseHandler::GetDatabaseDump(const base::ListValue* args) {
+ scoped_ptr<base::ListValue> list =
+ SyncFileSystemServiceFactory::GetForProfile(profile_)->DumpDatabase();
+ web_ui()->CallJavascriptFunction("DumpDatabase.onGetDatabaseDump",
+ *list.get());
+}
+
+} // namespace syncfs_internals

Powered by Google App Engine
This is Rietveld 408576698