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
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_SPEECH_EXTENSION_API_TTS_ENGINE_EXTENSION_API_H_
6 #define CHROME_BROWSER_SPEECH_EXTENSION_API_TTS_ENGINE_EXTENSION_API_H_
10 #include "base/memory/singleton.h"
11 #include "chrome/browser/speech/tts_controller.h"
12 #include "extensions/browser/extension_function.h"
24 namespace extensions
{
28 namespace tts_engine_events
{
29 extern const char kOnSpeak
[];
30 extern const char kOnStop
[];
31 extern const char kOnPause
[];
32 extern const char kOnResume
[];
35 // TtsEngineDelegate implementation used by TtsController.
36 class TtsExtensionEngine
: public TtsEngineDelegate
{
38 static TtsExtensionEngine
* GetInstance();
40 // Overridden from TtsEngineDelegate:
41 void GetVoices(content::BrowserContext
* browser_context
,
42 std::vector
<VoiceData
>* out_voices
) override
;
43 void Speak(Utterance
* utterance
, const VoiceData
& voice
) override
;
44 void Stop(Utterance
* utterance
) override
;
45 void Pause(Utterance
* utterance
) override
;
46 void Resume(Utterance
* utterance
) override
;
47 bool LoadBuiltInTtsExtension(
48 content::BrowserContext
* browser_context
) override
;
50 // Hidden/internal extension function used to allow TTS engine extensions
51 // to send events back to the client that's calling tts.speak().
52 class ExtensionTtsEngineSendTtsEventFunction
: public SyncExtensionFunction
{
54 ~ExtensionTtsEngineSendTtsEventFunction() override
{}
55 bool RunSync() override
;
56 DECLARE_EXTENSION_FUNCTION("ttsEngine.sendTtsEvent", TTSENGINE_SENDTTSEVENT
)
59 #endif // CHROME_BROWSER_SPEECH_EXTENSION_API_TTS_ENGINE_EXTENSION_API_H_