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 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_TTS_API_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_TTS_API_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_TTS_API_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_TTS_API_H_ |
7 | 7 |
8 #include <queue> | 8 #include <queue> |
9 | 9 |
10 #include "base/singleton.h" | 10 #include "base/singleton.h" |
(...skipping 22 matching lines...) Expand all Loading... |
33 double rate, | 33 double rate, |
34 double pitch, | 34 double pitch, |
35 double volume) = 0; | 35 double volume) = 0; |
36 | 36 |
37 // Stop speaking immediately and return true on success. | 37 // Stop speaking immediately and return true on success. |
38 virtual bool StopSpeaking() = 0; | 38 virtual bool StopSpeaking() = 0; |
39 | 39 |
40 // Return true if the synthesis engine is currently speaking. | 40 // Return true if the synthesis engine is currently speaking. |
41 virtual bool IsSpeaking() = 0; | 41 virtual bool IsSpeaking() = 0; |
42 | 42 |
43 virtual std::string error() { return error_; } | 43 virtual std::string error(); |
44 virtual void clear_error() { error_ = std::string(); } | 44 virtual void clear_error(); |
45 virtual void set_error(const std::string& error) { error_ = error; } | 45 virtual void set_error(const std::string& error); |
46 | 46 |
47 protected: | 47 protected: |
48 ExtensionTtsPlatformImpl() {} | 48 ExtensionTtsPlatformImpl() {} |
49 virtual ~ExtensionTtsPlatformImpl() {} | 49 virtual ~ExtensionTtsPlatformImpl() {} |
50 | 50 |
51 std::string error_; | 51 std::string error_; |
52 | 52 |
53 DISALLOW_COPY_AND_ASSIGN(ExtensionTtsPlatformImpl); | 53 DISALLOW_COPY_AND_ASSIGN(ExtensionTtsPlatformImpl); |
54 }; | 54 }; |
55 | 55 |
56 // Singleton class that manages text-to-speech. | 56 // Singleton class that manages text-to-speech. |
57 class ExtensionTtsController { | 57 class ExtensionTtsController { |
58 public: | 58 public: |
59 // Get the single instance of this class. | 59 // Get the single instance of this class. |
60 static ExtensionTtsController* GetInstance(); | 60 static ExtensionTtsController* GetInstance(); |
61 | 61 |
62 struct Utterance { | 62 struct Utterance { |
63 Utterance() | 63 Utterance(); |
64 : rate(-1.0), | 64 ~Utterance(); |
65 pitch(-1.0), | |
66 volume(-1.0), | |
67 success_task(NULL), | |
68 failure_task(NULL) { | |
69 } | |
70 | 65 |
71 std::string text; | 66 std::string text; |
72 std::string language; | 67 std::string language; |
73 std::string gender; | 68 std::string gender; |
74 double rate; | 69 double rate; |
75 double pitch; | 70 double pitch; |
76 double volume; | 71 double volume; |
77 | 72 |
78 Task* success_task; | 73 Task* success_task; |
79 Task* failure_task; | 74 Task* failure_task; |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 }; | 149 }; |
155 | 150 |
156 class ExtensionTtsIsSpeakingFunction : public SyncExtensionFunction { | 151 class ExtensionTtsIsSpeakingFunction : public SyncExtensionFunction { |
157 private: | 152 private: |
158 ~ExtensionTtsIsSpeakingFunction() {} | 153 ~ExtensionTtsIsSpeakingFunction() {} |
159 virtual bool RunImpl(); | 154 virtual bool RunImpl(); |
160 DECLARE_EXTENSION_FUNCTION_NAME("experimental.tts.isSpeaking") | 155 DECLARE_EXTENSION_FUNCTION_NAME("experimental.tts.isSpeaking") |
161 }; | 156 }; |
162 | 157 |
163 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_TTS_API_H_ | 158 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_TTS_API_H_ |
OLD | NEW |