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_EXTENSION_API_H_
6 #define CHROME_BROWSER_SPEECH_EXTENSION_API_TTS_EXTENSION_API_H_
10 #include "chrome/browser/extensions/api/profile_keyed_api_factory.h"
11 #include "chrome/browser/extensions/extension_function.h"
12 #include "chrome/browser/speech/tts_controller.h"
16 namespace extensions
{
18 class TtsSpeakFunction
19 : public AsyncExtensionFunction
{
21 virtual ~TtsSpeakFunction() {}
22 virtual bool RunImpl() OVERRIDE
;
23 DECLARE_EXTENSION_FUNCTION("tts.speak", TTS_SPEAK
)
26 class TtsStopSpeakingFunction
: public SyncExtensionFunction
{
28 virtual ~TtsStopSpeakingFunction() {}
29 virtual bool RunImpl() OVERRIDE
;
30 DECLARE_EXTENSION_FUNCTION("tts.stop", TTS_STOP
)
33 class TtsIsSpeakingFunction
: public SyncExtensionFunction
{
35 virtual ~TtsIsSpeakingFunction() {}
36 virtual bool RunImpl() OVERRIDE
;
37 DECLARE_EXTENSION_FUNCTION("tts.isSpeaking", TTS_ISSPEAKING
)
40 class TtsGetVoicesFunction
: public SyncExtensionFunction
{
42 virtual ~TtsGetVoicesFunction() {}
43 virtual bool RunImpl() OVERRIDE
;
44 DECLARE_EXTENSION_FUNCTION("tts.getVoices", TTS_GETVOICES
)
47 class TtsAPI
: public ProfileKeyedAPI
{
49 explicit TtsAPI(Profile
* profile
);
52 // Convenience method to get the TtsAPI for a profile.
53 static TtsAPI
* Get(Profile
* profile
);
55 // ProfileKeyedAPI implementation.
56 static ProfileKeyedAPIFactory
<TtsAPI
>* GetFactoryInstance();
59 friend class ProfileKeyedAPIFactory
<TtsAPI
>;
61 // ProfileKeyedAPI implementation.
62 static const char* service_name() {
65 static const bool kServiceIsNULLWhileTesting
= true;
68 } // namespace extensions
70 #endif // CHROME_BROWSER_SPEECH_EXTENSION_API_TTS_EXTENSION_API_H_