OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/speech/extension_api/tts_extension_api.h" | 5 #include "chrome/browser/speech/extension_api/tts_extension_api.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
10 #include "base/values.h" | 10 #include "base/values.h" |
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
305 | 305 |
306 bool TtsGetVoicesFunction::RunImpl() { | 306 bool TtsGetVoicesFunction::RunImpl() { |
307 std::vector<VoiceData> voices; | 307 std::vector<VoiceData> voices; |
308 TtsController::GetInstance()->GetVoices(GetProfile(), &voices); | 308 TtsController::GetInstance()->GetVoices(GetProfile(), &voices); |
309 | 309 |
310 scoped_ptr<ListValue> result_voices(new ListValue()); | 310 scoped_ptr<ListValue> result_voices(new ListValue()); |
311 for (size_t i = 0; i < voices.size(); ++i) { | 311 for (size_t i = 0; i < voices.size(); ++i) { |
312 const VoiceData& voice = voices[i]; | 312 const VoiceData& voice = voices[i]; |
313 DictionaryValue* result_voice = new DictionaryValue(); | 313 DictionaryValue* result_voice = new DictionaryValue(); |
314 result_voice->SetString(constants::kVoiceNameKey, voice.name); | 314 result_voice->SetString(constants::kVoiceNameKey, voice.name); |
315 result_voice->SetBoolean(constants::kRemoteKey, voice.remote); | |
316 if (!voice.lang.empty()) | 315 if (!voice.lang.empty()) |
317 result_voice->SetString(constants::kLangKey, voice.lang); | 316 result_voice->SetString(constants::kLangKey, voice.lang); |
318 if (voice.gender == TTS_GENDER_MALE) | 317 if (voice.gender == TTS_GENDER_MALE) |
319 result_voice->SetString(constants::kGenderKey, constants::kGenderMale); | 318 result_voice->SetString(constants::kGenderKey, constants::kGenderMale); |
320 else if (voice.gender == TTS_GENDER_FEMALE) | 319 else if (voice.gender == TTS_GENDER_FEMALE) |
321 result_voice->SetString(constants::kGenderKey, constants::kGenderFemale); | 320 result_voice->SetString(constants::kGenderKey, constants::kGenderFemale); |
322 if (!voice.extension_id.empty()) | 321 if (!voice.extension_id.empty()) |
323 result_voice->SetString(constants::kExtensionIdKey, voice.extension_id); | 322 result_voice->SetString(constants::kExtensionIdKey, voice.extension_id); |
324 | 323 |
325 ListValue* event_types = new ListValue(); | 324 ListValue* event_types = new ListValue(); |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
358 } | 357 } |
359 | 358 |
360 static base::LazyInstance<ProfileKeyedAPIFactory<TtsAPI> > | 359 static base::LazyInstance<ProfileKeyedAPIFactory<TtsAPI> > |
361 g_factory = LAZY_INSTANCE_INITIALIZER; | 360 g_factory = LAZY_INSTANCE_INITIALIZER; |
362 | 361 |
363 ProfileKeyedAPIFactory<TtsAPI>* TtsAPI::GetFactoryInstance() { | 362 ProfileKeyedAPIFactory<TtsAPI>* TtsAPI::GetFactoryInstance() { |
364 return &g_factory.Get(); | 363 return &g_factory.Get(); |
365 } | 364 } |
366 | 365 |
367 } // namespace extensions | 366 } // namespace extensions |
OLD | NEW |