Disable view source for Developer Tools.
[chromium-blink-merge.git] / chrome / browser / speech / extension_api / tts_engine_extension_api.h
blob1a2c25b9b91efbaa008aa7e37a8453392f66df78
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 <vector>
10 #include "base/memory/singleton.h"
11 #include "chrome/browser/speech/tts_controller.h"
12 #include "extensions/browser/extension_function.h"
14 class Utterance;
16 namespace base {
17 class ListValue;
20 namespace extensions {
21 class Extension;
24 namespace tts_engine_events {
25 extern const char kOnSpeak[];
26 extern const char kOnStop[];
27 extern const char kOnPause[];
28 extern const char kOnResume[];
31 // Return a list of all available voices registered by extensions.
32 void GetExtensionVoices(Profile* profile, std::vector<VoiceData>* out_voices);
34 // Find the first extension with a tts_voices in its
35 // manifest that matches the speech parameters of this utterance.
36 // If found, store a pointer to the extension in |matching_extension| and
37 // the index of the voice within the extension in |voice_index| and
38 // return true.
39 bool GetMatchingExtensionVoice(Utterance* utterance,
40 const extensions::Extension** matching_extension,
41 size_t* voice_index);
43 // Speak the given utterance by sending an event to the given TTS engine
44 // extension voice.
45 void ExtensionTtsEngineSpeak(Utterance* utterance,
46 const VoiceData& voice);
48 // Stop speaking the given utterance by sending an event to the extension
49 // associated with this utterance.
50 void ExtensionTtsEngineStop(Utterance* utterance);
52 // Pause in the middle of speaking this utterance.
53 void ExtensionTtsEnginePause(Utterance* utterance);
55 // Resume speaking this utterance.
56 void ExtensionTtsEngineResume(Utterance* utterance);
58 // Hidden/internal extension function used to allow TTS engine extensions
59 // to send events back to the client that's calling tts.speak().
60 class ExtensionTtsEngineSendTtsEventFunction : public SyncExtensionFunction {
61 private:
62 virtual ~ExtensionTtsEngineSendTtsEventFunction() {}
63 virtual bool RunImpl() OVERRIDE;
64 DECLARE_EXTENSION_FUNCTION("ttsEngine.sendTtsEvent", TTSENGINE_SENDTTSEVENT)
67 #endif // CHROME_BROWSER_SPEECH_EXTENSION_API_TTS_ENGINE_EXTENSION_API_H_