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