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

Unified Diff: chrome/browser/extensions/extension_debugger_api.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: Rebase and review changes. Created 8 years, 5 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/extensions/extension_debugger_api.cc
diff --git a/chrome/browser/extensions/extension_debugger_api.cc b/chrome/browser/extensions/extension_debugger_api.cc
index 6e59f22468537a0c1e9de7be9bb4d855dd174f7b..d6d05afe006bd32d04b4a49f5784e8c042678487 100644
--- a/chrome/browser/extensions/extension_debugger_api.cc
+++ b/chrome/browser/extensions/extension_debugger_api.cc
@@ -248,14 +248,11 @@ void ExtensionDevToolsClientHost::SendDetachedEvent() {
Profile* profile =
Profile::FromBrowserContext(web_contents_->GetBrowserContext());
if (profile != NULL && profile->GetExtensionEventRouter()) {
- ListValue args;
- args.Append(CreateDebuggeeId(tab_id_));
-
- std::string json_args;
- base::JSONWriter::Write(&args, &json_args);
+ ListValue* args = new ListValue();
+ args->Append(CreateDebuggeeId(tab_id_));
profile->GetExtensionEventRouter()->DispatchEventToExtension(
- extension_id_, keys::kOnDetach, json_args, profile, GURL());
+ extension_id_, keys::kOnDetach, args, profile, GURL());
}
}
@@ -298,18 +295,15 @@ void ExtensionDevToolsClientHost::DispatchOnInspectorFrontend(
if (!dictionary->GetString("method", &method_name))
return;
- ListValue args;
- args.Append(CreateDebuggeeId(tab_id_));
- args.Append(Value::CreateStringValue(method_name));
+ ListValue* args = new ListValue();
+ args->Append(CreateDebuggeeId(tab_id_));
+ args->Append(Value::CreateStringValue(method_name));
Value* params_value;
if (dictionary->Get("params", &params_value))
- args.Append(params_value->DeepCopy());
-
- std::string json_args;
- base::JSONWriter::Write(&args, &json_args);
+ args->Append(params_value->DeepCopy());
profile->GetExtensionEventRouter()->DispatchEventToExtension(
- extension_id_, keys::kOnEvent, json_args, profile, GURL());
+ extension_id_, keys::kOnEvent, args, profile, GURL());
} else {
SendCommandDebuggerFunction* function = pending_requests_[id];
if (!function)

Powered by Google App Engine
This is Rietveld 408576698