Upstream version 9.38.198.0
[platform/framework/web/crosswalk.git] / src / chrome / browser / speech / extension_api / tts_engine_extension_api.h
index 112c0e1..b7f00cf 100644 (file)
@@ -17,6 +17,10 @@ namespace base {
 class ListValue;
 }
 
+namespace content {
+class BrowserContext;
+}
+
 namespace extensions {
 class Extension;
 }
@@ -28,33 +32,21 @@ extern const char kOnPause[];
 extern const char kOnResume[];
 }
 
-// Return a list of all available voices registered by extensions.
-void GetExtensionVoices(Profile* profile, std::vector<VoiceData>* out_voices);
-
-// Find the first extension with a tts_voices in its
-// manifest that matches the speech parameters of this utterance.
-// If found, store a pointer to the extension in |matching_extension| and
-// the index of the voice within the extension in |voice_index| and
-// return true.
-bool GetMatchingExtensionVoice(Utterance* utterance,
-                               const extensions::Extension** matching_extension,
-                               size_t* voice_index);
-
-// Speak the given utterance by sending an event to the given TTS engine
-// extension voice.
-void ExtensionTtsEngineSpeak(Utterance* utterance,
-                             const VoiceData& voice);
-
-// Stop speaking the given utterance by sending an event to the extension
-// associated with this utterance.
-void ExtensionTtsEngineStop(Utterance* utterance);
-
-// Pause in the middle of speaking this utterance.
-void ExtensionTtsEnginePause(Utterance* utterance);
-
-// Resume speaking this utterance.
-void ExtensionTtsEngineResume(Utterance* utterance);
-
+// TtsEngineDelegate implementation used by TtsController.
+class TtsExtensionEngine : public TtsEngineDelegate {
+ public:
+  static TtsExtensionEngine* GetInstance();
+
+  // Overridden from TtsEngineDelegate:
+  virtual void GetVoices(content::BrowserContext* browser_context,
+                         std::vector<VoiceData>* out_voices) OVERRIDE;
+  virtual void Speak(Utterance* utterance, const VoiceData& voice) OVERRIDE;
+  virtual void Stop(Utterance* utterance) OVERRIDE;
+  virtual void Pause(Utterance* utterance) OVERRIDE;
+  virtual void Resume(Utterance* utterance) OVERRIDE;
+  virtual bool LoadBuiltInTtsExtension(
+      content::BrowserContext* browser_context) OVERRIDE;
+};
 // Hidden/internal extension function used to allow TTS engine extensions
 // to send events back to the client that's calling tts.speak().
 class ExtensionTtsEngineSendTtsEventFunction : public SyncExtensionFunction {