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

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: Build fix. 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/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 711880e877b94adef62980c433fe28ad3a0ec1ad..58af2adadc173fb235b86275a86df3ebe822f9f8 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()));
+ 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,15 +208,13 @@ 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,
utterance->profile(),
GURL());
}
@@ -225,7 +223,7 @@ void ExtensionTtsEngineStop(Utterance* utterance) {
utterance->profile()->GetExtensionEventRouter()->DispatchEventToExtension(
utterance->extension_id(),
events::kOnStop,
- "[]",
+ NULL,
utterance->profile(),
GURL());
}

Powered by Google App Engine
This is Rietveld 408576698