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
3 // found in the LICENSE file.
5 #include "chrome/browser/speech/tts_platform.h"
7 // Chrome OS doesn't have native TTS, instead it includes a built-in
8 // component extension that provides speech synthesis. This class includes
9 // an implementation of LoadBuiltInTtsExtension and dummy implementations of
12 class TtsPlatformImplChromeOs
: public TtsPlatformImpl
{
14 // TtsPlatformImpl overrides:
15 virtual bool PlatformImplAvailable() override
{
19 virtual bool LoadBuiltInTtsExtension(
20 content::BrowserContext
* browser_context
) override
{
21 TtsEngineDelegate
* tts_engine_delegate
=
22 TtsController::GetInstance()->GetTtsEngineDelegate();
23 if (tts_engine_delegate
)
24 return tts_engine_delegate
->LoadBuiltInTtsExtension(browser_context
);
30 const std::string
& utterance
,
31 const std::string
& lang
,
32 const VoiceData
& voice
,
33 const UtteranceContinuousParameters
& params
) override
{
37 virtual bool StopSpeaking() override
{
41 virtual void Pause() override
{}
43 virtual void Resume() override
{}
45 virtual bool IsSpeaking() override
{
49 virtual void GetVoices(std::vector
<VoiceData
>* out_voices
) override
{
52 // Get the single instance of this class.
53 static TtsPlatformImplChromeOs
* GetInstance();
56 TtsPlatformImplChromeOs() {}
57 virtual ~TtsPlatformImplChromeOs() {}
59 friend struct DefaultSingletonTraits
<TtsPlatformImplChromeOs
>;
61 DISALLOW_COPY_AND_ASSIGN(TtsPlatformImplChromeOs
);
65 TtsPlatformImpl
* TtsPlatformImpl::GetInstance() {
66 return TtsPlatformImplChromeOs::GetInstance();
70 TtsPlatformImplChromeOs
*
71 TtsPlatformImplChromeOs::GetInstance() {
72 return Singleton
<TtsPlatformImplChromeOs
>::get();