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

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 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..10c157ab21a5896ca33cc285789eeb2a2f907688
--- /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) {
nhiroki 2013/06/07 06:31:25 Can you add "DCHECK(args);"?
calvinlo 2013/06/07 06:40:29 Done.
+ 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;
nhiroki 2013/06/07 06:31:25 nit: indent
calvinlo 2013/06/07 06:40:29 Done.
+ dict->SetString("extensionID", itr->first.spec());
+ dict->SetString("status", itr->second);
+ list.Append(dict);
+ }
+
+ LOG(ERROR) << "GOT TO HERE list.size=" << status_map.size();
nhiroki 2013/06/07 06:31:25 Is this for debugging?
calvinlo 2013/06/07 06:40:29 Done. Sorry, forgot to take this out.
+ web_ui()->CallJavascriptFunction("extensionStatuses.onGetExtensionStatuses",
+ list);
+}
+
+} // namespace syncfs_internals

Powered by Google App Engine
This is Rietveld 408576698