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> |
11 #include <vector> | 11 #include <vector> |
12 | 12 |
13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
14 #include "base/memory/singleton.h" | 14 #include "base/memory/singleton.h" |
15 #include "base/memory/weak_ptr.h" | 15 #include "base/memory/weak_ptr.h" |
16 #include "chrome/browser/speech/tts_controller.h" | 16 #include "chrome/browser/speech/tts_controller.h" |
17 #include "url/gurl.h" | 17 #include "url/gurl.h" |
18 | 18 |
| 19 namespace content { |
| 20 class BrowserContext; |
| 21 } |
| 22 |
19 // 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 |
20 // extension APIs, maintaining a queue of pending utterances and keeping | 24 // extension APIs, maintaining a queue of pending utterances and keeping |
21 // track of all state. | 25 // track of all state. |
22 class TtsControllerImpl : public TtsController { | 26 class TtsControllerImpl : public TtsController { |
23 public: | 27 public: |
24 // Get the single instance of this class. | 28 // Get the single instance of this class. |
25 static TtsControllerImpl* GetInstance(); | 29 static TtsControllerImpl* GetInstance(); |
26 | 30 |
27 // TtsController methods | 31 // TtsController methods |
28 virtual bool IsSpeaking() OVERRIDE; | 32 virtual bool IsSpeaking() OVERRIDE; |
29 virtual void SpeakOrEnqueue(Utterance* utterance) OVERRIDE; | 33 virtual void SpeakOrEnqueue(Utterance* utterance) OVERRIDE; |
30 virtual void Stop() OVERRIDE; | 34 virtual void Stop() OVERRIDE; |
31 virtual void Pause() OVERRIDE; | 35 virtual void Pause() OVERRIDE; |
32 virtual void Resume() OVERRIDE; | 36 virtual void Resume() OVERRIDE; |
33 virtual void OnTtsEvent(int utterance_id, | 37 virtual void OnTtsEvent(int utterance_id, |
34 TtsEventType event_type, | 38 TtsEventType event_type, |
35 int char_index, | 39 int char_index, |
36 const std::string& error_message) OVERRIDE; | 40 const std::string& error_message) OVERRIDE; |
37 virtual void GetVoices(Profile* profile, | 41 virtual void GetVoices(content::BrowserContext* browser_context, |
38 std::vector<VoiceData>* out_voices) OVERRIDE; | 42 std::vector<VoiceData>* out_voices) OVERRIDE; |
39 virtual void VoicesChanged() OVERRIDE; | 43 virtual void VoicesChanged() OVERRIDE; |
40 virtual void AddVoicesChangedDelegate( | 44 virtual void AddVoicesChangedDelegate( |
41 VoicesChangedDelegate* delegate) OVERRIDE; | 45 VoicesChangedDelegate* delegate) OVERRIDE; |
42 virtual void RemoveVoicesChangedDelegate( | 46 virtual void RemoveVoicesChangedDelegate( |
43 VoicesChangedDelegate* delegate) OVERRIDE; | 47 VoicesChangedDelegate* delegate) OVERRIDE; |
44 virtual void SetTtsEngineDelegate(TtsEngineDelegate* delegate) OVERRIDE; | 48 virtual void SetTtsEngineDelegate(TtsEngineDelegate* delegate) OVERRIDE; |
45 virtual TtsEngineDelegate* GetTtsEngineDelegate() OVERRIDE; | 49 virtual TtsEngineDelegate* GetTtsEngineDelegate() OVERRIDE; |
46 virtual void SetPlatformImpl(TtsPlatformImpl* platform_impl) OVERRIDE; | 50 virtual void SetPlatformImpl(TtsPlatformImpl* platform_impl) OVERRIDE; |
47 virtual int QueueSize() OVERRIDE; | 51 virtual int QueueSize() OVERRIDE; |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 // dependency injection. | 95 // dependency injection. |
92 TtsPlatformImpl* platform_impl_; | 96 TtsPlatformImpl* platform_impl_; |
93 | 97 |
94 // The delegate that processes TTS requests with user-installed extensions. | 98 // The delegate that processes TTS requests with user-installed extensions. |
95 TtsEngineDelegate* tts_engine_delegate_; | 99 TtsEngineDelegate* tts_engine_delegate_; |
96 | 100 |
97 DISALLOW_COPY_AND_ASSIGN(TtsControllerImpl); | 101 DISALLOW_COPY_AND_ASSIGN(TtsControllerImpl); |
98 }; | 102 }; |
99 | 103 |
100 #endif // CHROME_BROWSER_SPEECH_TTS_CONTROLLER_IMPL_H_ | 104 #endif // CHROME_BROWSER_SPEECH_TTS_CONTROLLER_IMPL_H_ |
OLD | NEW |