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_
8 #include "base/memory/singleton.h"
9 #include "chrome/browser/extensions/extension_function.h"
17 namespace extensions
{
21 namespace tts_engine_events
{
22 extern const char kOnSpeak
[];
23 extern const char kOnStop
[];
26 // Return a list of all available voices registered by extensions.
27 void GetExtensionVoices(Profile
* profile
, base::ListValue
* result_voices
);
29 // Find the first extension with a tts_voices in its
30 // manifest that matches the speech parameters of this utterance.
31 // If found, store a pointer to the extension in |matching_extension| and
32 // the index of the voice within the extension in |voice_index| and
34 bool GetMatchingExtensionVoice(Utterance
* utterance
,
35 const extensions::Extension
** matching_extension
,
38 // Speak the given utterance by sending an event to the given TTS engine
40 void ExtensionTtsEngineSpeak(Utterance
* utterance
,
41 const extensions::Extension
* extension
,
44 // Stop speaking the given utterance by sending an event to the extension
45 // associated with this utterance.
46 void ExtensionTtsEngineStop(Utterance
* utterance
);
48 // Hidden/internal extension function used to allow TTS engine extensions
49 // to send events back to the client that's calling tts.speak().
50 class ExtensionTtsEngineSendTtsEventFunction
: public SyncExtensionFunction
{
52 virtual ~ExtensionTtsEngineSendTtsEventFunction() {}
53 virtual bool RunImpl() OVERRIDE
;
54 DECLARE_EXTENSION_FUNCTION("ttsEngine.sendTtsEvent", TTSENGINE_SENDTTSEVENT
)
57 #endif // CHROME_BROWSER_SPEECH_EXTENSION_API_TTS_ENGINE_EXTENSION_API_H_