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 | 8 |
9 #include <memory> | 9 #include <memory> |
10 #include <string> | 10 #include <string> |
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
304 TtsController::GetInstance()->Pause(); | 304 TtsController::GetInstance()->Pause(); |
305 return RespondNow(NoArguments()); | 305 return RespondNow(NoArguments()); |
306 } | 306 } |
307 | 307 |
308 ExtensionFunction::ResponseAction TtsResumeFunction::Run() { | 308 ExtensionFunction::ResponseAction TtsResumeFunction::Run() { |
309 TtsController::GetInstance()->Resume(); | 309 TtsController::GetInstance()->Resume(); |
310 return RespondNow(NoArguments()); | 310 return RespondNow(NoArguments()); |
311 } | 311 } |
312 | 312 |
313 ExtensionFunction::ResponseAction TtsIsSpeakingFunction::Run() { | 313 ExtensionFunction::ResponseAction TtsIsSpeakingFunction::Run() { |
314 return RespondNow(OneArgument(base::MakeUnique<base::FundamentalValue>( | 314 return RespondNow(OneArgument(base::MakeUnique<base::Value>( |
315 TtsController::GetInstance()->IsSpeaking()))); | 315 TtsController::GetInstance()->IsSpeaking()))); |
316 } | 316 } |
317 | 317 |
318 ExtensionFunction::ResponseAction TtsGetVoicesFunction::Run() { | 318 ExtensionFunction::ResponseAction TtsGetVoicesFunction::Run() { |
319 std::vector<VoiceData> voices; | 319 std::vector<VoiceData> voices; |
320 TtsController::GetInstance()->GetVoices(browser_context(), &voices); | 320 TtsController::GetInstance()->GetVoices(browser_context(), &voices); |
321 | 321 |
322 std::unique_ptr<base::ListValue> result_voices(new base::ListValue()); | 322 std::unique_ptr<base::ListValue> result_voices(new base::ListValue()); |
323 for (size_t i = 0; i < voices.size(); ++i) { | 323 for (size_t i = 0; i < voices.size(); ++i) { |
324 const VoiceData& voice = voices[i]; | 324 const VoiceData& voice = voices[i]; |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
368 } | 368 } |
369 | 369 |
370 static base::LazyInstance<BrowserContextKeyedAPIFactory<TtsAPI> > g_factory = | 370 static base::LazyInstance<BrowserContextKeyedAPIFactory<TtsAPI> > g_factory = |
371 LAZY_INSTANCE_INITIALIZER; | 371 LAZY_INSTANCE_INITIALIZER; |
372 | 372 |
373 BrowserContextKeyedAPIFactory<TtsAPI>* TtsAPI::GetFactoryInstance() { | 373 BrowserContextKeyedAPIFactory<TtsAPI>* TtsAPI::GetFactoryInstance() { |
374 return g_factory.Pointer(); | 374 return g_factory.Pointer(); |
375 } | 375 } |
376 | 376 |
377 } // namespace extensions | 377 } // namespace extensions |
OLD | NEW |