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