Home | History | Annotate | Download | only in speech
      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_extension_loader_chromeos.h"
      6 #include "chrome/browser/speech/tts_platform.h"
      7 
      8 // Chrome OS doesn't have native TTS, instead it includes a built-in
      9 // component extension that provides speech synthesis. This class includes
     10 // an implementation of LoadBuiltInTtsExtension and dummy implementations of
     11 // everything else.
     12 class TtsPlatformImplChromeOs
     13     : public TtsPlatformImpl {
     14  public:
     15   // TtsPlatformImpl overrides:
     16   virtual bool PlatformImplAvailable() OVERRIDE {
     17     return false;
     18   }
     19 
     20   virtual bool LoadBuiltInTtsExtension(Profile* profile) OVERRIDE {
     21     return TtsExtensionLoaderChromeOs::GetInstance(profile)->LoadTtsExtension();
     22   }
     23 
     24   virtual bool Speak(
     25       int utterance_id,
     26       const std::string& utterance,
     27       const std::string& lang,
     28       const VoiceData& voice,
     29       const UtteranceContinuousParameters& params) OVERRIDE {
     30     return false;
     31   }
     32 
     33   virtual bool StopSpeaking() OVERRIDE {
     34     return false;
     35   }
     36 
     37   virtual void Pause() OVERRIDE {}
     38 
     39   virtual void Resume() OVERRIDE {}
     40 
     41   virtual bool IsSpeaking() OVERRIDE {
     42     return false;
     43   }
     44 
     45   virtual void GetVoices(std::vector<VoiceData>* out_voices) OVERRIDE {
     46   }
     47 
     48   // Get the single instance of this class.
     49   static TtsPlatformImplChromeOs* GetInstance();
     50 
     51  private:
     52   TtsPlatformImplChromeOs() {}
     53   virtual ~TtsPlatformImplChromeOs() {}
     54 
     55   friend struct DefaultSingletonTraits<TtsPlatformImplChromeOs>;
     56 
     57   DISALLOW_COPY_AND_ASSIGN(TtsPlatformImplChromeOs);
     58 };
     59 
     60 // static
     61 TtsPlatformImpl* TtsPlatformImpl::GetInstance() {
     62   return TtsPlatformImplChromeOs::GetInstance();
     63 }
     64 
     65 // static
     66 TtsPlatformImplChromeOs*
     67 TtsPlatformImplChromeOs::GetInstance() {
     68   return Singleton<TtsPlatformImplChromeOs>::get();
     69 }
     70