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

Unified Diff: chrome/browser/extensions/settings/settings_frontend.cc

Issue 10694085: Refactor extension event distribution to use Values instead of JSON strings. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixing memory leak in a test. Created 8 years, 4 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/extensions/permissions_updater.cc ('k') | chrome/browser/extensions/system/system_api.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/settings/settings_frontend.cc
diff --git a/chrome/browser/extensions/settings/settings_frontend.cc b/chrome/browser/extensions/settings/settings_frontend.cc
index 137964bba62d5aac3e6a3140884a13632bc5f82c..a0978ff8ee2a289b86c49118db23768ea1d01438 100644
--- a/chrome/browser/extensions/settings/settings_frontend.cc
+++ b/chrome/browser/extensions/settings/settings_frontend.cc
@@ -9,6 +9,7 @@
#include "base/bind.h"
#include "base/bind_helpers.h"
#include "base/file_path.h"
+#include "base/json/json_reader.h"
#include "chrome/browser/extensions/event_names.h"
#include "chrome/browser/extensions/event_router.h"
#include "chrome/browser/extensions/extension_service.h"
@@ -40,14 +41,15 @@ class DefaultObserver : public SettingsObserver {
const std::string& extension_id,
settings_namespace::Namespace settings_namespace,
const std::string& change_json) OVERRIDE {
+ // TODO(gdk): This is a temporary hack while the refactoring for
+ // string-based event payloads is removed. http://crbug.com/136045
+ scoped_ptr<ListValue> args(new ListValue());
+ args->Append(base::JSONReader::Read(change_json));
+ args->Append(Value::CreateStringValue(settings_namespace::ToString(
+ settings_namespace)));
+
profile_->GetExtensionEventRouter()->DispatchEventToExtension(
- extension_id,
- event_names::kOnSettingsChanged,
- // This is the list of function arguments to pass to the onChanged
- // handler of extensions, an array of [changes, settings_namespace].
- std::string("[") + change_json + ",\"" +
- settings_namespace::ToString(settings_namespace) + "\"]",
- NULL,
+ extension_id, event_names::kOnSettingsChanged, args.Pass(), NULL,
GURL());
}
« no previous file with comments | « chrome/browser/extensions/permissions_updater.cc ('k') | chrome/browser/extensions/system/system_api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698