| 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 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 300 | 300 |
| 301 bool TtsGetVoicesFunction::RunImpl() { | 301 bool TtsGetVoicesFunction::RunImpl() { |
| 302 std::vector<VoiceData> voices; | 302 std::vector<VoiceData> voices; |
| 303 TtsController::GetInstance()->GetVoices(profile(), &voices); | 303 TtsController::GetInstance()->GetVoices(profile(), &voices); |
| 304 | 304 |
| 305 scoped_ptr<ListValue> result_voices(new ListValue()); | 305 scoped_ptr<ListValue> result_voices(new ListValue()); |
| 306 for (size_t i = 0; i < voices.size(); ++i) { | 306 for (size_t i = 0; i < voices.size(); ++i) { |
| 307 const VoiceData& voice = voices[i]; | 307 const VoiceData& voice = voices[i]; |
| 308 DictionaryValue* result_voice = new DictionaryValue(); | 308 DictionaryValue* result_voice = new DictionaryValue(); |
| 309 result_voice->SetString(constants::kVoiceNameKey, voice.name); | 309 result_voice->SetString(constants::kVoiceNameKey, voice.name); |
| 310 result_voice->SetBoolean(constants::kRemoteKey, voice.remote); |
| 310 if (!voice.lang.empty()) | 311 if (!voice.lang.empty()) |
| 311 result_voice->SetString(constants::kLangKey, voice.lang); | 312 result_voice->SetString(constants::kLangKey, voice.lang); |
| 312 if (voice.gender == TTS_GENDER_MALE) | 313 if (voice.gender == TTS_GENDER_MALE) |
| 313 result_voice->SetString(constants::kGenderKey, constants::kGenderMale); | 314 result_voice->SetString(constants::kGenderKey, constants::kGenderMale); |
| 314 else if (voice.gender == TTS_GENDER_FEMALE) | 315 else if (voice.gender == TTS_GENDER_FEMALE) |
| 315 result_voice->SetString(constants::kGenderKey, constants::kGenderFemale); | 316 result_voice->SetString(constants::kGenderKey, constants::kGenderFemale); |
| 316 if (!voice.extension_id.empty()) | 317 if (!voice.extension_id.empty()) |
| 317 result_voice->SetString(constants::kExtensionIdKey, voice.extension_id); | 318 result_voice->SetString(constants::kExtensionIdKey, voice.extension_id); |
| 318 | 319 |
| 319 ListValue* event_types = new ListValue(); | 320 ListValue* event_types = new ListValue(); |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 352 } | 353 } |
| 353 | 354 |
| 354 static base::LazyInstance<ProfileKeyedAPIFactory<TtsAPI> > | 355 static base::LazyInstance<ProfileKeyedAPIFactory<TtsAPI> > |
| 355 g_factory = LAZY_INSTANCE_INITIALIZER; | 356 g_factory = LAZY_INSTANCE_INITIALIZER; |
| 356 | 357 |
| 357 ProfileKeyedAPIFactory<TtsAPI>* TtsAPI::GetFactoryInstance() { | 358 ProfileKeyedAPIFactory<TtsAPI>* TtsAPI::GetFactoryInstance() { |
| 358 return &g_factory.Get(); | 359 return &g_factory.Get(); |
| 359 } | 360 } |
| 360 | 361 |
| 361 } // namespace extensions | 362 } // namespace extensions |
| OLD | NEW |