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 <stddef.h> | 7 #include <stddef.h> |
8 #include <string> | 8 #include <string> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
330 result_voice->SetString(constants::kGenderKey, constants::kGenderMale); | 330 result_voice->SetString(constants::kGenderKey, constants::kGenderMale); |
331 else if (voice.gender == TTS_GENDER_FEMALE) | 331 else if (voice.gender == TTS_GENDER_FEMALE) |
332 result_voice->SetString(constants::kGenderKey, constants::kGenderFemale); | 332 result_voice->SetString(constants::kGenderKey, constants::kGenderFemale); |
333 if (!voice.extension_id.empty()) | 333 if (!voice.extension_id.empty()) |
334 result_voice->SetString(constants::kExtensionIdKey, voice.extension_id); | 334 result_voice->SetString(constants::kExtensionIdKey, voice.extension_id); |
335 | 335 |
336 base::ListValue* event_types = new base::ListValue(); | 336 base::ListValue* event_types = new base::ListValue(); |
337 for (std::set<TtsEventType>::iterator iter = voice.events.begin(); | 337 for (std::set<TtsEventType>::iterator iter = voice.events.begin(); |
338 iter != voice.events.end(); ++iter) { | 338 iter != voice.events.end(); ++iter) { |
339 const char* event_name_constant = TtsEventTypeToString(*iter); | 339 const char* event_name_constant = TtsEventTypeToString(*iter); |
340 event_types->Append(new base::StringValue(event_name_constant)); | 340 event_types->AppendString(event_name_constant); |
341 } | 341 } |
342 result_voice->Set(constants::kEventTypesKey, event_types); | 342 result_voice->Set(constants::kEventTypesKey, event_types); |
343 | 343 |
344 result_voices->Append(result_voice); | 344 result_voices->Append(result_voice); |
345 } | 345 } |
346 | 346 |
347 SetResult(std::move(result_voices)); | 347 SetResult(std::move(result_voices)); |
348 return true; | 348 return true; |
349 } | 349 } |
350 | 350 |
(...skipping 16 matching lines...) Expand all Loading... |
367 } | 367 } |
368 | 368 |
369 static base::LazyInstance<BrowserContextKeyedAPIFactory<TtsAPI> > g_factory = | 369 static base::LazyInstance<BrowserContextKeyedAPIFactory<TtsAPI> > g_factory = |
370 LAZY_INSTANCE_INITIALIZER; | 370 LAZY_INSTANCE_INITIALIZER; |
371 | 371 |
372 BrowserContextKeyedAPIFactory<TtsAPI>* TtsAPI::GetFactoryInstance() { | 372 BrowserContextKeyedAPIFactory<TtsAPI>* TtsAPI::GetFactoryInstance() { |
373 return g_factory.Pointer(); | 373 return g_factory.Pointer(); |
374 } | 374 } |
375 | 375 |
376 } // namespace extensions | 376 } // namespace extensions |
OLD | NEW |