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

Unified Diff: chrome/browser/speech/extension_api/tts_extension_api_controller.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_extension_api_controller.cc
diff --git a/chrome/browser/speech/extension_api/tts_extension_api_controller.cc b/chrome/browser/speech/extension_api/tts_extension_api_controller.cc
index b8df2f8b335e50918618152761acda6ae6bc1047..b54318cf5983cbe985e8f4d09ad9c2d1b3cdbeb7 100644
--- a/chrome/browser/speech/extension_api/tts_extension_api_controller.cc
+++ b/chrome/browser/speech/extension_api/tts_extension_api_controller.cc
@@ -108,7 +108,6 @@ void Utterance::OnTtsEvent(TtsEventType event_type,
if (src_id_ < 0)
return;
- ListValue args;
DictionaryValue* event = new DictionaryValue();
if (char_index != kInvalidCharIndex)
event->SetInteger(constants::kCharIndexKey, char_index);
@@ -118,14 +117,14 @@ void Utterance::OnTtsEvent(TtsEventType event_type,
}
event->SetInteger(constants::kSrcIdKey, src_id_);
event->SetBoolean(constants::kIsFinalEventKey, finished_);
- args.Set(0, event);
- std::string json_args;
- base::JSONWriter::Write(&args, &json_args);
+
+ scoped_ptr<ListValue> arguments(new ListValue());
+ arguments->Set(0, event);
profile_->GetExtensionEventRouter()->DispatchEventToExtension(
src_extension_id_,
events::kOnEvent,
- json_args,
+ arguments.Pass(),
profile_,
src_url_);
}

Powered by Google App Engine
This is Rietveld 408576698