| 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 | 7 |
| 8 #include <vector> |
| 9 |
| 8 #include "base/memory/singleton.h" | 10 #include "base/memory/singleton.h" |
| 9 #include "chrome/browser/extensions/extension_function.h" | 11 #include "chrome/browser/extensions/extension_function.h" |
| 12 #include "chrome/browser/speech/tts_controller.h" |
| 10 | 13 |
| 11 class Utterance; | 14 class Utterance; |
| 12 | 15 |
| 13 namespace base { | 16 namespace base { |
| 14 class ListValue; | 17 class ListValue; |
| 15 } | 18 } |
| 16 | 19 |
| 17 namespace extensions { | 20 namespace extensions { |
| 18 class Extension; | 21 class Extension; |
| 19 } | 22 } |
| 20 | 23 |
| 21 namespace tts_engine_events { | 24 namespace tts_engine_events { |
| 22 extern const char kOnSpeak[]; | 25 extern const char kOnSpeak[]; |
| 23 extern const char kOnStop[]; | 26 extern const char kOnStop[]; |
| 24 } | 27 } |
| 25 | 28 |
| 26 // Return a list of all available voices registered by extensions. | 29 // Return a list of all available voices registered by extensions. |
| 27 void GetExtensionVoices(Profile* profile, base::ListValue* result_voices); | 30 void GetExtensionVoices(Profile* profile, std::vector<VoiceData>* out_voices); |
| 28 | 31 |
| 29 // Find the first extension with a tts_voices in its | 32 // Find the first extension with a tts_voices in its |
| 30 // manifest that matches the speech parameters of this utterance. | 33 // manifest that matches the speech parameters of this utterance. |
| 31 // If found, store a pointer to the extension in |matching_extension| and | 34 // 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 | 35 // the index of the voice within the extension in |voice_index| and |
| 33 // return true. | 36 // return true. |
| 34 bool GetMatchingExtensionVoice(Utterance* utterance, | 37 bool GetMatchingExtensionVoice(Utterance* utterance, |
| 35 const extensions::Extension** matching_extension, | 38 const extensions::Extension** matching_extension, |
| 36 size_t* voice_index); | 39 size_t* voice_index); |
| 37 | 40 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 48 // Hidden/internal extension function used to allow TTS engine extensions | 51 // Hidden/internal extension function used to allow TTS engine extensions |
| 49 // to send events back to the client that's calling tts.speak(). | 52 // to send events back to the client that's calling tts.speak(). |
| 50 class ExtensionTtsEngineSendTtsEventFunction : public SyncExtensionFunction { | 53 class ExtensionTtsEngineSendTtsEventFunction : public SyncExtensionFunction { |
| 51 private: | 54 private: |
| 52 virtual ~ExtensionTtsEngineSendTtsEventFunction() {} | 55 virtual ~ExtensionTtsEngineSendTtsEventFunction() {} |
| 53 virtual bool RunImpl() OVERRIDE; | 56 virtual bool RunImpl() OVERRIDE; |
| 54 DECLARE_EXTENSION_FUNCTION("ttsEngine.sendTtsEvent", TTSENGINE_SENDTTSEVENT) | 57 DECLARE_EXTENSION_FUNCTION("ttsEngine.sendTtsEvent", TTSENGINE_SENDTTSEVENT) |
| 55 }; | 58 }; |
| 56 | 59 |
| 57 #endif // CHROME_BROWSER_SPEECH_EXTENSION_API_TTS_ENGINE_EXTENSION_API_H_ | 60 #endif // CHROME_BROWSER_SPEECH_EXTENSION_API_TTS_ENGINE_EXTENSION_API_H_ |
| OLD | NEW |