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

Unified Diff: chrome/browser/speech/extension_api/tts_engine_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/speech/extension_api/tts_engine_extension_api.cc
diff --git a/chrome/browser/speech/extension_api/tts_engine_extension_api.cc b/chrome/browser/speech/extension_api/tts_engine_extension_api.cc
index 2774e50da019c1a20afdc56714e5e49081b07d5c..8ed12c623300ca06a61169c0069ccb1de90017e9 100644
--- a/chrome/browser/speech/extension_api/tts_engine_extension_api.cc
+++ b/chrome/browser/speech/extension_api/tts_engine_extension_api.cc
@@ -188,8 +188,8 @@ void ExtensionTtsEngineSpeak(Utterance* utterance,
bool sends_end_event =
(event_types.find(constants::kEventTypeEnd) != event_types.end());
- ListValue args;
- args.Set(0, Value::CreateStringValue(utterance->text()));
+ scoped_ptr<ListValue> args(new ListValue());
+ args->Set(0, Value::CreateStringValue(utterance->text()));
// Pass through most options to the speech engine, but remove some
// that are handled internally.
@@ -208,24 +208,23 @@ void ExtensionTtsEngineSpeak(Utterance* utterance,
if (options->HasKey(constants::kOnEventKey))
options->Remove(constants::kOnEventKey, NULL);
- args.Set(1, options);
- args.Set(2, Value::CreateIntegerValue(utterance->id()));
- std::string json_args;
- base::JSONWriter::Write(&args, &json_args);
+ args->Set(1, options);
+ args->Set(2, Value::CreateIntegerValue(utterance->id()));
utterance->profile()->GetExtensionEventRouter()->DispatchEventToExtension(
extension->id(),
events::kOnSpeak,
- json_args,
+ args.Pass(),
utterance->profile(),
GURL());
}
void ExtensionTtsEngineStop(Utterance* utterance) {
+ scoped_ptr<ListValue> args(new ListValue());
utterance->profile()->GetExtensionEventRouter()->DispatchEventToExtension(
utterance->extension_id(),
events::kOnStop,
- "[]",
+ args.Pass(),
utterance->profile(),
GURL());
}
« no previous file with comments | « chrome/browser/history/history_extension_api.cc ('k') | chrome/browser/speech/extension_api/tts_extension_api_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698