| 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 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "base/memory/singleton.h" | 9 #include "base/memory/singleton.h" |
| 10 #include "chrome/browser/extensions/extension_function.h" | 10 #include "chrome/browser/extensions/extension_function.h" |
| 11 | 11 |
| 12 class Extension; | |
| 13 class Utterance; | 12 class Utterance; |
| 14 | 13 |
| 15 namespace base { | 14 namespace base { |
| 16 class ListValue; | 15 class ListValue; |
| 17 } | 16 } |
| 18 | 17 |
| 18 namespace extensions { |
| 19 class Extension; |
| 20 } |
| 21 |
| 19 // Return a list of all available voices registered by extensions. | 22 // Return a list of all available voices registered by extensions. |
| 20 void GetExtensionVoices(Profile* profile, base::ListValue* result_voices); | 23 void GetExtensionVoices(Profile* profile, base::ListValue* result_voices); |
| 21 | 24 |
| 22 // Find the first extension with a tts_voices in its | 25 // Find the first extension with a tts_voices in its |
| 23 // manifest that matches the speech parameters of this utterance. | 26 // manifest that matches the speech parameters of this utterance. |
| 24 // If found, store a pointer to the extension in |matching_extension| and | 27 // If found, store a pointer to the extension in |matching_extension| and |
| 25 // the index of the voice within the extension in |voice_index| and | 28 // the index of the voice within the extension in |voice_index| and |
| 26 // return true. | 29 // return true. |
| 27 bool GetMatchingExtensionVoice(Utterance* utterance, | 30 bool GetMatchingExtensionVoice(Utterance* utterance, |
| 28 const Extension** matching_extension, | 31 const extensions::Extension** matching_extension, |
| 29 size_t* voice_index); | 32 size_t* voice_index); |
| 30 | 33 |
| 31 // Speak the given utterance by sending an event to the given TTS engine | 34 // Speak the given utterance by sending an event to the given TTS engine |
| 32 // extension voice. | 35 // extension voice. |
| 33 void ExtensionTtsEngineSpeak(Utterance* utterance, | 36 void ExtensionTtsEngineSpeak(Utterance* utterance, |
| 34 const Extension* extension, | 37 const extensions::Extension* extension, |
| 35 size_t voice_index); | 38 size_t voice_index); |
| 36 | 39 |
| 37 // Stop speaking the given utterance by sending an event to the extension | 40 // Stop speaking the given utterance by sending an event to the extension |
| 38 // associated with this utterance. | 41 // associated with this utterance. |
| 39 void ExtensionTtsEngineStop(Utterance* utterance); | 42 void ExtensionTtsEngineStop(Utterance* utterance); |
| 40 | 43 |
| 41 // Hidden/internal extension function used to allow TTS engine extensions | 44 // Hidden/internal extension function used to allow TTS engine extensions |
| 42 // to send events back to the client that's calling tts.speak(). | 45 // to send events back to the client that's calling tts.speak(). |
| 43 class ExtensionTtsEngineSendTtsEventFunction : public SyncExtensionFunction { | 46 class ExtensionTtsEngineSendTtsEventFunction : public SyncExtensionFunction { |
| 44 private: | 47 private: |
| 45 virtual ~ExtensionTtsEngineSendTtsEventFunction() {} | 48 virtual ~ExtensionTtsEngineSendTtsEventFunction() {} |
| 46 virtual bool RunImpl() OVERRIDE; | 49 virtual bool RunImpl() OVERRIDE; |
| 47 DECLARE_EXTENSION_FUNCTION_NAME("ttsEngine.sendTtsEvent") | 50 DECLARE_EXTENSION_FUNCTION_NAME("ttsEngine.sendTtsEvent") |
| 48 }; | 51 }; |
| 49 | 52 |
| 50 #endif // CHROME_BROWSER_SPEECH_EXTENSION_API_TTS_ENGINE_EXTENSION_API_H_ | 53 #endif // CHROME_BROWSER_SPEECH_EXTENSION_API_TTS_ENGINE_EXTENSION_API_H_ |
| OLD | NEW |