| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_TTS_CONTROLLER_IMPL_H_ | 5 #ifndef CHROME_BROWSER_SPEECH_TTS_CONTROLLER_IMPL_H_ |
| 6 #define CHROME_BROWSER_SPEECH_TTS_CONTROLLER_IMPL_H_ | 6 #define CHROME_BROWSER_SPEECH_TTS_CONTROLLER_IMPL_H_ |
| 7 | 7 |
| 8 #include <queue> | 8 #include <queue> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 | 22 |
| 23 // Singleton class that manages text-to-speech for the TTS and TTS engine | 23 // Singleton class that manages text-to-speech for the TTS and TTS engine |
| 24 // extension APIs, maintaining a queue of pending utterances and keeping | 24 // extension APIs, maintaining a queue of pending utterances and keeping |
| 25 // track of all state. | 25 // track of all state. |
| 26 class TtsControllerImpl : public TtsController { | 26 class TtsControllerImpl : public TtsController { |
| 27 public: | 27 public: |
| 28 // Get the single instance of this class. | 28 // Get the single instance of this class. |
| 29 static TtsControllerImpl* GetInstance(); | 29 static TtsControllerImpl* GetInstance(); |
| 30 | 30 |
| 31 // TtsController methods | 31 // TtsController methods |
| 32 virtual bool IsSpeaking() override; | 32 bool IsSpeaking() override; |
| 33 virtual void SpeakOrEnqueue(Utterance* utterance) override; | 33 void SpeakOrEnqueue(Utterance* utterance) override; |
| 34 virtual void Stop() override; | 34 void Stop() override; |
| 35 virtual void Pause() override; | 35 void Pause() override; |
| 36 virtual void Resume() override; | 36 void Resume() override; |
| 37 virtual void OnTtsEvent(int utterance_id, | 37 void OnTtsEvent(int utterance_id, |
| 38 TtsEventType event_type, | 38 TtsEventType event_type, |
| 39 int char_index, | 39 int char_index, |
| 40 const std::string& error_message) override; | 40 const std::string& error_message) override; |
| 41 virtual void GetVoices(content::BrowserContext* browser_context, | 41 void GetVoices(content::BrowserContext* browser_context, |
| 42 std::vector<VoiceData>* out_voices) override; | 42 std::vector<VoiceData>* out_voices) override; |
| 43 virtual void VoicesChanged() override; | 43 void VoicesChanged() override; |
| 44 virtual void AddVoicesChangedDelegate( | 44 void AddVoicesChangedDelegate(VoicesChangedDelegate* delegate) override; |
| 45 VoicesChangedDelegate* delegate) override; | 45 void RemoveVoicesChangedDelegate(VoicesChangedDelegate* delegate) override; |
| 46 virtual void RemoveVoicesChangedDelegate( | 46 void SetTtsEngineDelegate(TtsEngineDelegate* delegate) override; |
| 47 VoicesChangedDelegate* delegate) override; | 47 TtsEngineDelegate* GetTtsEngineDelegate() override; |
| 48 virtual void SetTtsEngineDelegate(TtsEngineDelegate* delegate) override; | 48 void SetPlatformImpl(TtsPlatformImpl* platform_impl) override; |
| 49 virtual TtsEngineDelegate* GetTtsEngineDelegate() override; | 49 int QueueSize() override; |
| 50 virtual void SetPlatformImpl(TtsPlatformImpl* platform_impl) override; | |
| 51 virtual int QueueSize() override; | |
| 52 | 50 |
| 53 protected: | 51 protected: |
| 54 TtsControllerImpl(); | 52 TtsControllerImpl(); |
| 55 virtual ~TtsControllerImpl(); | 53 ~TtsControllerImpl() override; |
| 56 | 54 |
| 57 private: | 55 private: |
| 58 // Get the platform TTS implementation (or injected mock). | 56 // Get the platform TTS implementation (or injected mock). |
| 59 TtsPlatformImpl* GetPlatformImpl(); | 57 TtsPlatformImpl* GetPlatformImpl(); |
| 60 | 58 |
| 61 // Start speaking the given utterance. Will either take ownership of | 59 // Start speaking the given utterance. Will either take ownership of |
| 62 // |utterance| or delete it if there's an error. Returns true on success. | 60 // |utterance| or delete it if there's an error. Returns true on success. |
| 63 void SpeakNow(Utterance* utterance); | 61 void SpeakNow(Utterance* utterance); |
| 64 | 62 |
| 65 // Clear the utterance queue. If send_events is true, will send | 63 // Clear the utterance queue. If send_events is true, will send |
| (...skipping 29 matching lines...) Expand all Loading... |
| 95 // dependency injection. | 93 // dependency injection. |
| 96 TtsPlatformImpl* platform_impl_; | 94 TtsPlatformImpl* platform_impl_; |
| 97 | 95 |
| 98 // The delegate that processes TTS requests with user-installed extensions. | 96 // The delegate that processes TTS requests with user-installed extensions. |
| 99 TtsEngineDelegate* tts_engine_delegate_; | 97 TtsEngineDelegate* tts_engine_delegate_; |
| 100 | 98 |
| 101 DISALLOW_COPY_AND_ASSIGN(TtsControllerImpl); | 99 DISALLOW_COPY_AND_ASSIGN(TtsControllerImpl); |
| 102 }; | 100 }; |
| 103 | 101 |
| 104 #endif // CHROME_BROWSER_SPEECH_TTS_CONTROLLER_IMPL_H_ | 102 #endif // CHROME_BROWSER_SPEECH_TTS_CONTROLLER_IMPL_H_ |
| OLD | NEW |