| 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 <math.h> | 5 #include <math.h> |
| 6 | 6 |
| 7 #include "base/memory/singleton.h" | 7 #include "base/memory/singleton.h" |
| 8 #include "chrome/browser/speech/tts_platform.h" | 8 #include "chrome/browser/speech/tts_platform.h" |
| 9 #include "content/public/browser/browser_thread.h" | 9 #include "content/public/browser/browser_thread.h" |
| 10 | 10 |
| 11 #include "library_loaders/libspeechd.h" | 11 #include "library_loaders/libspeechd.h" |
| 12 | 12 |
| 13 using content::BrowserThread; | 13 using content::BrowserThread; |
| 14 | 14 |
| 15 namespace { | 15 namespace { |
| 16 | 16 |
| 17 const char kNotSupportedError[] = | 17 const char kNotSupportedError[] = |
| 18 "Native speech synthesis not supported on this platform."; | 18 "Native speech synthesis not supported on this platform."; |
| 19 | 19 |
| 20 } // namespace | 20 } // namespace |
| 21 | 21 |
| 22 class TtsPlatformImplLinux : public TtsPlatformImpl { | 22 class TtsPlatformImplLinux : public TtsPlatformImpl { |
| 23 public: | 23 public: |
| 24 virtual bool PlatformImplAvailable(); | 24 virtual bool PlatformImplAvailable() OVERRIDE; |
| 25 virtual bool Speak( | 25 virtual bool Speak( |
| 26 int utterance_id, | 26 int utterance_id, |
| 27 const std::string& utterance, | 27 const std::string& utterance, |
| 28 const std::string& lang, | 28 const std::string& lang, |
| 29 const UtteranceContinuousParameters& params); | 29 const UtteranceContinuousParameters& params) OVERRIDE; |
| 30 virtual bool StopSpeaking(); | 30 virtual bool StopSpeaking() OVERRIDE; |
| 31 virtual bool IsSpeaking(); | 31 virtual bool IsSpeaking() OVERRIDE; |
| 32 virtual bool SendsEvent(TtsEventType event_type); | 32 virtual bool SendsEvent(TtsEventType event_type) OVERRIDE; |
| 33 void OnSpeechEvent(SPDNotificationType type); | 33 void OnSpeechEvent(SPDNotificationType type); |
| 34 | 34 |
| 35 // Get the single instance of this class. | 35 // Get the single instance of this class. |
| 36 static TtsPlatformImplLinux* GetInstance(); | 36 static TtsPlatformImplLinux* GetInstance(); |
| 37 | 37 |
| 38 private: | 38 private: |
| 39 TtsPlatformImplLinux(); | 39 TtsPlatformImplLinux(); |
| 40 virtual ~TtsPlatformImplLinux(); | 40 virtual ~TtsPlatformImplLinux(); |
| 41 | 41 |
| 42 // Resets the connection with speech dispatcher. | 42 // Resets the connection with speech dispatcher. |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 225 // static | 225 // static |
| 226 TtsPlatformImplLinux* TtsPlatformImplLinux::GetInstance() { | 226 TtsPlatformImplLinux* TtsPlatformImplLinux::GetInstance() { |
| 227 return Singleton<TtsPlatformImplLinux, | 227 return Singleton<TtsPlatformImplLinux, |
| 228 LeakySingletonTraits<TtsPlatformImplLinux> >::get(); | 228 LeakySingletonTraits<TtsPlatformImplLinux> >::get(); |
| 229 } | 229 } |
| 230 | 230 |
| 231 // static | 231 // static |
| 232 TtsPlatformImpl* TtsPlatformImpl::GetInstance() { | 232 TtsPlatformImpl* TtsPlatformImpl::GetInstance() { |
| 233 return TtsPlatformImplLinux::GetInstance(); | 233 return TtsPlatformImplLinux::GetInstance(); |
| 234 } | 234 } |
| OLD | NEW |