| OLD | NEW |
| (Empty) |
| 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 #ifndef CHROME_BROWSER_CHROMEOS_DBUS_SPEECH_SYNTHESIZER_CLIENT_H_ | |
| 6 #define CHROME_BROWSER_CHROMEOS_DBUS_SPEECH_SYNTHESIZER_CLIENT_H_ | |
| 7 #pragma once | |
| 8 | |
| 9 #include <string> | |
| 10 | |
| 11 #include "base/callback.h" | |
| 12 | |
| 13 namespace dbus { | |
| 14 class Bus; | |
| 15 } | |
| 16 | |
| 17 namespace chromeos { | |
| 18 | |
| 19 // SpeechSynthesizerClient is used to communicate with the speech synthesizer. | |
| 20 // All method should be called from the origin thread (UI thread) which | |
| 21 // initializes the DBusThreadManager instance. | |
| 22 class SpeechSynthesizerClient { | |
| 23 public: | |
| 24 // A callback function called when the result of IsSpeaking is ready. | |
| 25 // The argument indicates if the speech synthesizer is speaking or not. | |
| 26 typedef base::Callback<void(bool)> IsSpeakingCallback; | |
| 27 | |
| 28 virtual ~SpeechSynthesizerClient(); | |
| 29 | |
| 30 // Speaks the specified text with properties. | |
| 31 // Use the constants below for properties. | |
| 32 // An example of |properties|: "rate=1.0 pitch=1.0" | |
| 33 virtual void Speak(const std::string& text, | |
| 34 const std::string& properties) = 0; | |
| 35 | |
| 36 // Stops speaking the current utterance. | |
| 37 virtual void StopSpeaking() = 0; | |
| 38 | |
| 39 // Checks if the engine is currently speaking. | |
| 40 // |callback| will be called on the origin thread later with the result. | |
| 41 virtual void IsSpeaking(IsSpeakingCallback callback) = 0; | |
| 42 | |
| 43 // Factory function, creates a new instance and returns ownership. | |
| 44 // For normal usage, access the singleton via DBusThreadManager::Get(). | |
| 45 static SpeechSynthesizerClient* Create(dbus::Bus* bus); | |
| 46 | |
| 47 // Constants to be used with the properties argument to Speak. | |
| 48 static const char kSpeechPropertyLocale[]; | |
| 49 static const char kSpeechPropertyGender[]; | |
| 50 static const char kSpeechPropertyRate[]; | |
| 51 static const char kSpeechPropertyPitch[]; | |
| 52 static const char kSpeechPropertyVolume[]; | |
| 53 static const char kSpeechPropertyEquals[]; | |
| 54 static const char kSpeechPropertyDelimiter[]; | |
| 55 | |
| 56 protected: | |
| 57 // Create() should be used instead. | |
| 58 SpeechSynthesizerClient(); | |
| 59 | |
| 60 private: | |
| 61 DISALLOW_COPY_AND_ASSIGN(SpeechSynthesizerClient); | |
| 62 }; | |
| 63 | |
| 64 } // namespace chromeos | |
| 65 | |
| 66 #endif // CHROME_BROWSER_CHROMEOS_DBUS_SPEECH_SYNTHESIZER_CLIENT_H_ | |
| OLD | NEW |