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

Unified Diff: chrome/browser/history/history_extension_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: 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
Index: chrome/browser/history/history_extension_api.cc
diff --git a/chrome/browser/history/history_extension_api.cc b/chrome/browser/history/history_extension_api.cc
index ee11af98a133a2f3a843cac693c246fe6b26740b..54d77939cd02ae0d7b6daf6c010d22196fd019c1 100644
--- a/chrome/browser/history/history_extension_api.cc
+++ b/chrome/browser/history/history_extension_api.cc
@@ -159,9 +159,7 @@ void HistoryExtensionEventRouter::HistoryUrlVisited(
scoped_ptr<HistoryItem> history_item = GetHistoryItem(details->row);
scoped_ptr<ListValue> args = OnVisited::Create(*history_item);
- std::string json_args;
- base::JSONWriter::Write(args.get(), &json_args);
- DispatchEvent(profile, kOnVisited, json_args);
+ DispatchEvent(profile, kOnVisited, args.Pass());
}
void HistoryExtensionEventRouter::HistoryUrlsRemoved(
@@ -178,17 +176,16 @@ void HistoryExtensionEventRouter::HistoryUrlsRemoved(
removed.urls.reset(urls);
scoped_ptr<ListValue> args = OnVisitRemoved::Create(removed);
- std::string json_args;
- base::JSONWriter::Write(args.get(), &json_args);
- DispatchEvent(profile, kOnVisitRemoved, json_args);
+ DispatchEvent(profile, kOnVisitRemoved, args.Pass());
}
-void HistoryExtensionEventRouter::DispatchEvent(Profile* profile,
- const char* event_name,
- const std::string& json_args) {
+void HistoryExtensionEventRouter::DispatchEvent(
+ Profile* profile,
+ const char* event_name,
+ scoped_ptr<ListValue> event_args) {
if (profile && profile->GetExtensionEventRouter()) {
profile->GetExtensionEventRouter()->DispatchEventToRenderers(
- event_name, json_args, profile, GURL(),
+ event_name, event_args.Pass(), profile, GURL(),
extensions::EventFilteringInfo());
}
}
« no previous file with comments | « chrome/browser/history/history_extension_api.h ('k') | chrome/browser/speech/extension_api/tts_engine_extension_api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698