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

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

Issue 8698003: Adding CSP to Speech Input API sample. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: License. Created 9 years 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 <!doctype html>
1 <html> 2 <html>
2 <script> 3 <head>
3 function setStartIcon() { 4 <title>Speech Input API Background Page</title>
4 chrome.browserAction.setIcon({ path: "start.png" }); 5 </head>
5 } 6 <body>
6 7 <script src="background.js"></script>
7 function setStopIcon() { 8 </body>
8 chrome.browserAction.setIcon({ path: "stop.png" });
9 }
10
11 chrome.browserAction.onClicked.addListener(function(tab) {
12 chrome.experimental.speechInput.isRecording(function(recording) {
13 if (!recording) {
14 chrome.experimental.speechInput.start({}, function() {
15 if (chrome.extension.lastError) {
16 alert("Couldn't start speech input: " + chrome.extension.lastError.mes sage);
17 setStartIcon();
18 } else {
19 setStopIcon();
20 }
21 });
22 } else {
23 chrome.experimental.speechInput.stop(function() {
24 setStartIcon();
25 });
26 }
27 });
28 });
29
30 chrome.experimental.speechInput.onError.addListener(function(error) {
31 alert("Speech input failed: " + error.code);
32 setStartIcon();
33 });
34
35 chrome.experimental.speechInput.onResult.addListener(function(result) {
36 alert(result.hypotheses[0].utterance);
37 setStartIcon();
38 });
39 </script>
40 </html> 9 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698