• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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.
4 
5 #include "chrome/browser/speech/tts_platform.h"
6 
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
10 // everything else.
11 
12 class TtsPlatformImplChromeOs : public TtsPlatformImpl {
13  public:
14   // TtsPlatformImpl overrides:
PlatformImplAvailable()15   virtual bool PlatformImplAvailable() OVERRIDE {
16     return false;
17   }
18 
LoadBuiltInTtsExtension(content::BrowserContext * browser_context)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);
25     return false;
26   }
27 
Speak(int utterance_id,const std::string & utterance,const std::string & lang,const VoiceData & voice,const UtteranceContinuousParameters & params)28   virtual bool Speak(
29       int utterance_id,
30       const std::string& utterance,
31       const std::string& lang,
32       const VoiceData& voice,
33       const UtteranceContinuousParameters& params) OVERRIDE {
34     return false;
35   }
36 
StopSpeaking()37   virtual bool StopSpeaking() OVERRIDE {
38     return false;
39   }
40 
Pause()41   virtual void Pause() OVERRIDE {}
42 
Resume()43   virtual void Resume() OVERRIDE {}
44 
IsSpeaking()45   virtual bool IsSpeaking() OVERRIDE {
46     return false;
47   }
48 
GetVoices(std::vector<VoiceData> * out_voices)49   virtual void GetVoices(std::vector<VoiceData>* out_voices) OVERRIDE {
50   }
51 
52   // Get the single instance of this class.
53   static TtsPlatformImplChromeOs* GetInstance();
54 
55  private:
TtsPlatformImplChromeOs()56   TtsPlatformImplChromeOs() {}
~TtsPlatformImplChromeOs()57   virtual ~TtsPlatformImplChromeOs() {}
58 
59   friend struct DefaultSingletonTraits<TtsPlatformImplChromeOs>;
60 
61   DISALLOW_COPY_AND_ASSIGN(TtsPlatformImplChromeOs);
62 };
63 
64 // static
GetInstance()65 TtsPlatformImpl* TtsPlatformImpl::GetInstance() {
66   return TtsPlatformImplChromeOs::GetInstance();
67 }
68 
69 // static
70 TtsPlatformImplChromeOs*
GetInstance()71 TtsPlatformImplChromeOs::GetInstance() {
72   return Singleton<TtsPlatformImplChromeOs>::get();
73 }
74