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