| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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_SPEECH_EXTENSION_API_TTS_EXTENSION_API_CONTROLLER_H_ | 5 #ifndef CHROME_BROWSER_SPEECH_EXTENSION_API_TTS_EXTENSION_API_CONTROLLER_H_ |
| 6 #define CHROME_BROWSER_SPEECH_EXTENSION_API_TTS_EXTENSION_API_CONTROLLER_H_ | 6 #define CHROME_BROWSER_SPEECH_EXTENSION_API_TTS_EXTENSION_API_CONTROLLER_H_ |
| 7 | 7 |
| 8 #include <queue> | 8 #include <queue> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 | 184 |
| 185 // Singleton class that manages text-to-speech for the TTS and TTS engine | 185 // Singleton class that manages text-to-speech for the TTS and TTS engine |
| 186 // extension APIs, maintaining a queue of pending utterances and keeping | 186 // extension APIs, maintaining a queue of pending utterances and keeping |
| 187 // track of all state. | 187 // track of all state. |
| 188 class ExtensionTtsController { | 188 class ExtensionTtsController { |
| 189 public: | 189 public: |
| 190 // Get the single instance of this class. | 190 // Get the single instance of this class. |
| 191 static ExtensionTtsController* GetInstance(); | 191 static ExtensionTtsController* GetInstance(); |
| 192 | 192 |
| 193 // Returns true if we're currently speaking an utterance. | 193 // Returns true if we're currently speaking an utterance. |
| 194 bool IsSpeaking() const; | 194 bool IsSpeaking(); |
| 195 | 195 |
| 196 // Speak the given utterance. If the utterance's can_enqueue flag is true | 196 // Speak the given utterance. If the utterance's can_enqueue flag is true |
| 197 // and another utterance is in progress, adds it to the end of the queue. | 197 // and another utterance is in progress, adds it to the end of the queue. |
| 198 // Otherwise, interrupts any current utterance and speaks this one | 198 // Otherwise, interrupts any current utterance and speaks this one |
| 199 // immediately. | 199 // immediately. |
| 200 void SpeakOrEnqueue(Utterance* utterance); | 200 void SpeakOrEnqueue(Utterance* utterance); |
| 201 | 201 |
| 202 // Stop all utterances and flush the queue. | 202 // Stop all utterances and flush the queue. |
| 203 void Stop(); | 203 void Stop(); |
| 204 | 204 |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 250 std::queue<Utterance*> utterance_queue_; | 250 std::queue<Utterance*> utterance_queue_; |
| 251 | 251 |
| 252 // A pointer to the platform implementation of text-to-speech, for | 252 // A pointer to the platform implementation of text-to-speech, for |
| 253 // dependency injection. | 253 // dependency injection. |
| 254 ExtensionTtsPlatformImpl* platform_impl_; | 254 ExtensionTtsPlatformImpl* platform_impl_; |
| 255 | 255 |
| 256 DISALLOW_COPY_AND_ASSIGN(ExtensionTtsController); | 256 DISALLOW_COPY_AND_ASSIGN(ExtensionTtsController); |
| 257 }; | 257 }; |
| 258 | 258 |
| 259 #endif // CHROME_BROWSER_SPEECH_EXTENSION_API_TTS_EXTENSION_API_CONTROLLER_H_ | 259 #endif // CHROME_BROWSER_SPEECH_EXTENSION_API_TTS_EXTENSION_API_CONTROLLER_H_ |
| OLD | NEW |