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

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

Issue 16398011: Show ExtensionID->OriginSyncStatus in syncfs-internals WebUI (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase to test mac compile Created 7 years, 6 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_file_system_internals/extension_statuses_handler.cc
diff --git a/chrome/browser/ui/webui/sync_file_system_internals/extension_statuses_handler.cc b/chrome/browser/ui/webui/sync_file_system_internals/extension_statuses_handler.cc
new file mode 100644
index 0000000000000000000000000000000000000000..15aa2f4e214cd96f4f5ad3c5e411c8d4a1c1cd87
--- /dev/null
+++ b/chrome/browser/ui/webui/sync_file_system_internals/extension_statuses_handler.cc
@@ -0,0 +1,57 @@
+// 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/extension_statuses_handler.h"
+
+#include <map>
+
+#include "base/bind.h"
+#include "base/bind_helpers.h"
+#include "base/values.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"
+#include "grit/sync_file_system_internals_resources.h"
+
+using sync_file_system::SyncFileSystemServiceFactory;
+using sync_file_system::SyncServiceState;
+
+namespace syncfs_internals {
+
+ExtensionStatusesHandler::ExtensionStatusesHandler(Profile* profile)
+ : profile_(profile) {}
+
+ExtensionStatusesHandler::~ExtensionStatusesHandler() {}
+
+void ExtensionStatusesHandler::RegisterMessages() {
+ web_ui()->RegisterMessageCallback(
+ "getExtensionStatuses",
+ base::Bind(&ExtensionStatusesHandler::GetExtensionStatuses,
+ base::Unretained(this)));
+}
+
+void ExtensionStatusesHandler::GetExtensionStatuses(
+ const base::ListValue* args) {
+ DCHECK(args);
+ std::map<GURL, std::string> status_map;
+ SyncFileSystemServiceFactory::GetForProfile(profile_)->GetExtensionStatusMap(
+ &status_map);
+
+ base::ListValue list;
+ for (std::map<GURL, std::string>::const_iterator itr = status_map.begin();
+ itr != status_map.end();
+ ++itr) {
+ base::DictionaryValue* dict = new DictionaryValue;
+ dict->SetString("extensionID", itr->first.spec());
+ dict->SetString("status", itr->second);
+ list.Append(dict);
+ }
+
+ web_ui()->CallJavascriptFunction("ExtensionStatuses.onGetExtensionStatuses",
+ list);
+}
+
+} // namespace syncfs_internals

Powered by Google App Engine
This is Rietveld 408576698