Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7443)

Unified Diff: chrome/common/extensions/docs/examples/api/speechInput/basic/background.html

Issue 8536022: Adding static documentation to the speech input extension API. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fixing nits and adding a example. Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/common/extensions/docs/examples/api/speechInput/basic/background.html
diff --git a/chrome/common/extensions/docs/examples/api/speechInput/basic/background.html b/chrome/common/extensions/docs/examples/api/speechInput/basic/background.html
new file mode 100644
index 0000000000000000000000000000000000000000..131b2ff0b50c3b8b615b7c92c63911febd7e2e9e
--- /dev/null
+++ b/chrome/common/extensions/docs/examples/api/speechInput/basic/background.html
@@ -0,0 +1,26 @@
+<html>
+<script>
+function checkStart() {
Satish 2011/11/17 16:29:23 since this is a small enough function and used onl
Leandro Graciá Gil 2011/11/17 22:02:45 Done.
+ if (chrome.extension.lastError) {
+ alert("Couldn't start speech input: " + chrome.extension.lastError.message);
+ }
+}
+
+chrome.browserAction.onClicked.addListener(function(tab) {
+ chrome.experimental.speechInput.isRecording(function (recording) {
+ if (!recording)
Satish 2011/11/17 16:29:23 use braces here?
Leandro Graciá Gil 2011/11/17 22:02:45 Done.
+ chrome.experimental.speechInput.start({}, checkStart);
Satish 2011/11/17 16:29:23 it may be useful if we change the browser action i
Satish 2011/11/17 16:29:23 is that empty dictionary {} required or can a null
Leandro Graciá Gil 2011/11/17 22:02:45 Done.
Leandro Graciá Gil 2011/11/17 22:02:45 It is required.
+ else
+ chrome.experimental.speechInput.stop();
+ });
+});
+
+chrome.experimental.speechInput.onError.addListener(function(error) {
+ alert("Speech input failed: " + error.code);
+});
+
+chrome.experimental.speechInput.onResult.addListener(function(result) {
+ alert(result.hypotheses[0].utterance);
+});
+</script>
+</html>

Powered by Google App Engine
This is Rietveld 408576698