summaryrefslogtreecommitdiffstats
path: root/chrome/browser/extensions/extension_tts_engine_api.h
diff options
context:
space:
mode:
authordmazzoni@chromium.org <dmazzoni@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-07-07 05:25:00 +0000
committerdmazzoni@chromium.org <dmazzoni@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-07-07 05:25:00 +0000
commitc63f2b7fe4fe2977f858a8e36d5f48db17eff2e7 (patch)
tree3d04e487b74ab61f09d2454850104d8e3b125996 /chrome/browser/extensions/extension_tts_engine_api.h
parent3768ee10e91e95f4ff90bbe8177ffa407725d955 (diff)
downloadchromium_src-c63f2b7fe4fe2977f858a8e36d5f48db17eff2e7.zip
chromium_src-c63f2b7fe4fe2977f858a8e36d5f48db17eff2e7.tar.gz
chromium_src-c63f2b7fe4fe2977f858a8e36d5f48db17eff2e7.tar.bz2
Extend TTS extension API to support richer events returned from the engine
to the client. Previously we just had a completed event; this adds start, word boundary, sentence boundary, and marker boundary. In addition, interrupted and canceled, which were previously errors, now become events. Mac and Windows implementations extended to support as many of these events as possible. BUG=67713 BUG=70198 BUG=75106 BUG=83404 TEST=Updates all TTS API tests to be event-based, and adds new tests. Review URL: http://codereview.chromium.org/6792014 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@91665 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/extensions/extension_tts_engine_api.h')
-rw-r--r--chrome/browser/extensions/extension_tts_engine_api.h45
1 files changed, 45 insertions, 0 deletions
diff --git a/chrome/browser/extensions/extension_tts_engine_api.h b/chrome/browser/extensions/extension_tts_engine_api.h
new file mode 100644
index 0000000..7c14937
--- /dev/null
+++ b/chrome/browser/extensions/extension_tts_engine_api.h
@@ -0,0 +1,45 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_TTS_ENGINE_API_H_
+#define CHROME_BROWSER_EXTENSIONS_EXTENSION_TTS_ENGINE_API_H_
+
+#include "base/memory/singleton.h"
+#include "chrome/browser/extensions/extension_function.h"
+
+class Extension;
+class Utterance;
+
+// Return a list of all available voices registered by extensions.
+void GetExtensionVoices(Profile* profile, ListValue* result_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 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 Extension* extension,
+ size_t voice_index);
+
+// Stop speaking the given utterance by sending an event to the extension
+// associated with this utterance.
+void ExtensionTtsEngineStop(Utterance* utterance);
+
+// 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 {
+ private:
+ virtual ~ExtensionTtsEngineSendTtsEventFunction() {}
+ virtual bool RunImpl() OVERRIDE;
+ DECLARE_EXTENSION_FUNCTION_NAME("experimental.ttsEngine.sendTtsEvent")
+};
+
+#endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_TTS_ENGINE_API_H_