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_ENGINE_EXTENSION_API_H_ | 5 #ifndef CHROME_BROWSER_SPEECH_EXTENSION_API_TTS_ENGINE_EXTENSION_API_H_ |
6 #define CHROME_BROWSER_SPEECH_EXTENSION_API_TTS_ENGINE_EXTENSION_API_H_ | 6 #define CHROME_BROWSER_SPEECH_EXTENSION_API_TTS_ENGINE_EXTENSION_API_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/memory/singleton.h" | 10 #include "base/memory/singleton.h" |
11 #include "chrome/browser/speech/tts_controller.h" | 11 #include "chrome/browser/speech/tts_controller.h" |
12 #include "extensions/browser/extension_function.h" | 12 #include "extensions/browser/extension_function.h" |
13 | 13 |
14 class Utterance; | 14 class Utterance; |
15 | 15 |
16 namespace base { | 16 namespace base { |
17 class ListValue; | 17 class ListValue; |
18 } | 18 } |
19 | 19 |
| 20 namespace content { |
| 21 class BrowserContext; |
| 22 } |
| 23 |
20 namespace extensions { | 24 namespace extensions { |
21 class Extension; | 25 class Extension; |
22 } | 26 } |
23 | 27 |
24 namespace tts_engine_events { | 28 namespace tts_engine_events { |
25 extern const char kOnSpeak[]; | 29 extern const char kOnSpeak[]; |
26 extern const char kOnStop[]; | 30 extern const char kOnStop[]; |
27 extern const char kOnPause[]; | 31 extern const char kOnPause[]; |
28 extern const char kOnResume[]; | 32 extern const char kOnResume[]; |
29 } | 33 } |
30 | 34 |
31 // TtsEngineDelegate implementation used by TtsController. | 35 // TtsEngineDelegate implementation used by TtsController. |
32 class TtsExtensionEngine : public TtsEngineDelegate { | 36 class TtsExtensionEngine : public TtsEngineDelegate { |
33 public: | 37 public: |
34 static TtsExtensionEngine* GetInstance(); | 38 static TtsExtensionEngine* GetInstance(); |
35 | 39 |
36 // Overridden from TtsEngineDelegate: | 40 // Overridden from TtsEngineDelegate: |
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 Speak(Utterance* utterance, const VoiceData& voice) OVERRIDE; | 43 virtual void Speak(Utterance* utterance, const VoiceData& voice) OVERRIDE; |
40 virtual void Stop(Utterance* utterance) OVERRIDE; | 44 virtual void Stop(Utterance* utterance) OVERRIDE; |
41 virtual void Pause(Utterance* utterance) OVERRIDE; | 45 virtual void Pause(Utterance* utterance) OVERRIDE; |
42 virtual void Resume(Utterance* utterance) OVERRIDE; | 46 virtual void Resume(Utterance* utterance) OVERRIDE; |
43 virtual bool LoadBuiltInTtsExtension(Profile* profile) OVERRIDE; | 47 virtual bool LoadBuiltInTtsExtension( |
| 48 content::BrowserContext* browser_context) OVERRIDE; |
44 }; | 49 }; |
45 | |
46 // Hidden/internal extension function used to allow TTS engine extensions | 50 // Hidden/internal extension function used to allow TTS engine extensions |
47 // to send events back to the client that's calling tts.speak(). | 51 // to send events back to the client that's calling tts.speak(). |
48 class ExtensionTtsEngineSendTtsEventFunction : public SyncExtensionFunction { | 52 class ExtensionTtsEngineSendTtsEventFunction : public SyncExtensionFunction { |
49 private: | 53 private: |
50 virtual ~ExtensionTtsEngineSendTtsEventFunction() {} | 54 virtual ~ExtensionTtsEngineSendTtsEventFunction() {} |
51 virtual bool RunSync() OVERRIDE; | 55 virtual bool RunSync() OVERRIDE; |
52 DECLARE_EXTENSION_FUNCTION("ttsEngine.sendTtsEvent", TTSENGINE_SENDTTSEVENT) | 56 DECLARE_EXTENSION_FUNCTION("ttsEngine.sendTtsEvent", TTSENGINE_SENDTTSEVENT) |
53 }; | 57 }; |
54 | 58 |
55 #endif // CHROME_BROWSER_SPEECH_EXTENSION_API_TTS_ENGINE_EXTENSION_API_H_ | 59 #endif // CHROME_BROWSER_SPEECH_EXTENSION_API_TTS_ENGINE_EXTENSION_API_H_ |
OLD | NEW |