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 389bffebed0dafdc5b226518b8b0e402e0db18d4..216f23a640e144a1895625b0f77c27f65a24dcd0 100644 |
--- a/chrome/browser/speech/extension_api/tts_engine_extension_api.cc |
+++ b/chrome/browser/speech/extension_api/tts_engine_extension_api.cc |
@@ -37,7 +37,7 @@ std::string TrimLanguageCode(std::string lang) { |
} |
} |
-void GetExtensionVoices(Profile* profile, ListValue* result_voices) { |
+void GetExtensionVoices(Profile* profile, std::vector<VoiceData>* out_voices) { |
ExtensionService* service = profile->GetExtensionService(); |
DCHECK(service); |
extensions::EventRouter* event_router = |
@@ -63,34 +63,28 @@ void GetExtensionVoices(Profile* profile, ListValue* result_voices) { |
for (size_t i = 0; i < tts_voices->size(); ++i) { |
const extensions::TtsVoice& voice = tts_voices->at(i); |
- DictionaryValue* result_voice = new DictionaryValue(); |
- if (!voice.voice_name.empty()) |
- result_voice->SetString(constants::kVoiceNameKey, voice.voice_name); |
- if (!voice.lang.empty()) |
- result_voice->SetString(constants::kLangKey, voice.lang); |
- if (!voice.gender.empty()) |
- result_voice->SetString(constants::kGenderKey, voice.gender); |
- result_voice->SetString(constants::kExtensionIdKey, extension->id()); |
- |
- ListValue* event_types = new ListValue(); |
+ |
+ out_voices->push_back(VoiceData()); |
tommi (sloooow) - chröme
2013/03/07 13:04:46
nit: if you can assume that |out_voices| is always
dmazzoni
2013/03/19 17:30:22
Actually we can't assume that - there are also pla
tommi (sloooow) - chröme
2013/03/21 14:34:02
OK as is
|
+ VoiceData* result_voice = &out_voices->back(); |
hans
2013/03/09 14:19:52
i would have made result_voice a reference instead
dmazzoni
2013/03/19 17:30:22
Done.
|
+ |
+ result_voice->name = voice.voice_name; |
+ result_voice->lang = voice.lang; |
+ result_voice->gender = voice.gender; |
+ result_voice->extension_id = extension->id(); |
+ |
for (std::set<std::string>::const_iterator iter = |
tommi (sloooow) - chröme
2013/03/07 13:04:46
std::copy now that both variables are stl?
dmazzoni
2013/03/19 17:30:22
I tried this and it crashes - any idea what I'm do
tommi (sloooow) - chröme
2013/03/21 14:34:02
hmm... maybe you need to do something like:
resul
|
voice.event_types.begin(); |
iter != voice.event_types.end(); |
++iter) { |
- event_types->Append(Value::CreateStringValue(*iter)); |
+ result_voice->events.push_back(*iter); |
} |
// If the extension sends end events, the controller will handle |
// queueing and send interrupted and cancelled events. |
if (voice.event_types.find(constants::kEventTypeEnd) != |
voice.event_types.end()) { |
- event_types->Append( |
- Value::CreateStringValue(constants::kEventTypeCancelled)); |
- event_types->Append(Value::CreateStringValue( |
- constants::kEventTypeInterrupted)); |
+ result_voice->events.push_back(constants::kEventTypeCancelled); |
+ result_voice->events.push_back(constants::kEventTypeInterrupted); |
} |
- |
- result_voice->Set(constants::kEventTypesKey, event_types); |
- result_voices->Append(result_voice); |
} |
} |
} |