| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/chromeos/cros/speech_synthesis_library.h" | 5 #include "chrome/browser/chromeos/cros/speech_synthesis_library.h" |
| 6 | 6 |
| 7 #include "base/message_loop.h" | 7 #include "base/message_loop.h" |
| 8 #include "chrome/browser/chrome_thread.h" | 8 #include "chrome/browser/chrome_thread.h" |
| 9 #include "chrome/browser/chromeos/cros/cros_library.h" | 9 #include "chrome/browser/chromeos/cros/cros_library.h" |
| 10 #include "cros/chromeos_speech_synthesis.h" | 10 #include "cros/chromeos_speech_synthesis.h" |
| 11 | 11 |
| 12 namespace chromeos { | 12 namespace chromeos { |
| 13 | 13 |
| 14 bool SpeechSynthesisLibraryImpl::Speak(const char* text) { | 14 class SpeechSynthesisLibraryImpl : public SpeechSynthesisLibrary { |
| 15 return chromeos::Speak(text); | 15 public: |
| 16 } | 16 SpeechSynthesisLibraryImpl() {} |
| 17 virtual ~SpeechSynthesisLibraryImpl() {} |
| 17 | 18 |
| 18 bool SpeechSynthesisLibraryImpl::SetSpeakProperties(const char* props) { | 19 bool Speak(const char* text) { |
| 19 return chromeos::SetSpeakProperties(props); | 20 return chromeos::Speak(text); |
| 20 } | 21 } |
| 21 | 22 |
| 22 bool SpeechSynthesisLibraryImpl::StopSpeaking() { | 23 bool SetSpeakProperties(const char* props) { |
| 23 return chromeos::StopSpeaking(); | 24 return chromeos::SetSpeakProperties(props); |
| 24 } | 25 } |
| 25 | 26 |
| 26 bool SpeechSynthesisLibraryImpl::IsSpeaking() { | 27 bool StopSpeaking() { |
| 27 return chromeos::IsSpeaking(); | 28 return chromeos::StopSpeaking(); |
| 28 } | 29 } |
| 29 | 30 |
| 30 void SpeechSynthesisLibraryImpl::InitTts(InitStatusCallback callback) { | 31 bool IsSpeaking() { |
| 31 chromeos::InitTts(callback); | 32 return chromeos::IsSpeaking(); |
| 33 } |
| 34 |
| 35 void InitTts(InitStatusCallback callback) { |
| 36 chromeos::InitTts(callback); |
| 37 } |
| 38 |
| 39 private: |
| 40 DISALLOW_COPY_AND_ASSIGN(SpeechSynthesisLibraryImpl); |
| 41 }; |
| 42 |
| 43 class SpeechSynthesisLibraryStubImpl : public SpeechSynthesisLibrary { |
| 44 public: |
| 45 SpeechSynthesisLibraryStubImpl() {} |
| 46 virtual ~SpeechSynthesisLibraryStubImpl() {} |
| 47 bool Speak(const char* text) { return true; } |
| 48 bool SetSpeakProperties(const char* props) { return true; } |
| 49 bool StopSpeaking() { return true; } |
| 50 bool IsSpeaking() { return false; } |
| 51 void InitTts(InitStatusCallback callback) {} |
| 52 |
| 53 private: |
| 54 DISALLOW_COPY_AND_ASSIGN(SpeechSynthesisLibraryStubImpl); |
| 55 }; |
| 56 |
| 57 // static |
| 58 SpeechSynthesisLibrary* SpeechSynthesisLibrary::GetImpl(bool stub) { |
| 59 if (stub) |
| 60 return new SpeechSynthesisLibraryStubImpl(); |
| 61 else |
| 62 return new SpeechSynthesisLibraryImpl(); |
| 32 } | 63 } |
| 33 | 64 |
| 34 } // namespace chromeos | 65 } // namespace chromeos |
| OLD | NEW |