| 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 <memory> | 8 #include <memory> |
| 9 #include <queue> | 9 #include <queue> |
| 10 #include <set> | 10 #include <set> |
| 11 #include <string> | 11 #include <string> |
| 12 #include <vector> | 12 #include <vector> |
| 13 | 13 |
| 14 #include "base/gtest_prod_util.h" |
| 14 #include "base/macros.h" | 15 #include "base/macros.h" |
| 15 #include "base/memory/singleton.h" | 16 #include "base/memory/singleton.h" |
| 16 #include "chrome/browser/speech/tts_controller.h" | 17 #include "chrome/browser/speech/tts_controller.h" |
| 17 #include "url/gurl.h" | 18 #include "url/gurl.h" |
| 18 | 19 |
| 19 namespace content { | 20 namespace content { |
| 20 class BrowserContext; | 21 class BrowserContext; |
| 21 } | 22 } |
| 22 | 23 |
| 23 // Singleton class that manages text-to-speech for the TTS and TTS engine | 24 // Singleton class that manages text-to-speech for the TTS and TTS engine |
| (...skipping 23 matching lines...) Expand all Loading... |
| 47 void SetTtsEngineDelegate(TtsEngineDelegate* delegate) override; | 48 void SetTtsEngineDelegate(TtsEngineDelegate* delegate) override; |
| 48 TtsEngineDelegate* GetTtsEngineDelegate() override; | 49 TtsEngineDelegate* GetTtsEngineDelegate() override; |
| 49 void SetPlatformImpl(TtsPlatformImpl* platform_impl) override; | 50 void SetPlatformImpl(TtsPlatformImpl* platform_impl) override; |
| 50 int QueueSize() override; | 51 int QueueSize() override; |
| 51 | 52 |
| 52 protected: | 53 protected: |
| 53 TtsControllerImpl(); | 54 TtsControllerImpl(); |
| 54 ~TtsControllerImpl() override; | 55 ~TtsControllerImpl() override; |
| 55 | 56 |
| 56 private: | 57 private: |
| 58 FRIEND_TEST_ALL_PREFIXES(TtsControllerTest, TestGetMatchingVoice); |
| 59 |
| 57 // Get the platform TTS implementation (or injected mock). | 60 // Get the platform TTS implementation (or injected mock). |
| 58 TtsPlatformImpl* GetPlatformImpl(); | 61 TtsPlatformImpl* GetPlatformImpl(); |
| 59 | 62 |
| 60 // Start speaking the given utterance. Will either take ownership of | 63 // Start speaking the given utterance. Will either take ownership of |
| 61 // |utterance| or delete it if there's an error. Returns true on success. | 64 // |utterance| or delete it if there's an error. Returns true on success. |
| 62 void SpeakNow(Utterance* utterance); | 65 void SpeakNow(Utterance* utterance); |
| 63 | 66 |
| 64 // Clear the utterance queue. If send_events is true, will send | 67 // Clear the utterance queue. If send_events is true, will send |
| 65 // TTS_EVENT_CANCELLED events on each one. | 68 // TTS_EVENT_CANCELLED events on each one. |
| 66 void ClearUtteranceQueue(bool send_events); | 69 void ClearUtteranceQueue(bool send_events); |
| (...skipping 27 matching lines...) Expand all Loading... |
| 94 // dependency injection. | 97 // dependency injection. |
| 95 TtsPlatformImpl* platform_impl_; | 98 TtsPlatformImpl* platform_impl_; |
| 96 | 99 |
| 97 // The delegate that processes TTS requests with user-installed extensions. | 100 // The delegate that processes TTS requests with user-installed extensions. |
| 98 TtsEngineDelegate* tts_engine_delegate_; | 101 TtsEngineDelegate* tts_engine_delegate_; |
| 99 | 102 |
| 100 DISALLOW_COPY_AND_ASSIGN(TtsControllerImpl); | 103 DISALLOW_COPY_AND_ASSIGN(TtsControllerImpl); |
| 101 }; | 104 }; |
| 102 | 105 |
| 103 #endif // CHROME_BROWSER_SPEECH_TTS_CONTROLLER_IMPL_H_ | 106 #endif // CHROME_BROWSER_SPEECH_TTS_CONTROLLER_IMPL_H_ |
| OLD | NEW |