Commit 8ba31633 authored by mkwst@chromium.org's avatar mkwst@chromium.org

Adding `content_security_policy` to Speech Input API sample.

As a drive-by, this CL also regenerates the `experimental.settings` docs, which someone apparently forgot to do after committing. :)

BUG=92644
TEST=

Review URL: http://codereview.chromium.org/8698003

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@111588 0039d316-1c4b-4281-b951-d872f2087c98
parent e0851ba4
<!doctype html>
<html>
<script>
function setStartIcon() {
chrome.browserAction.setIcon({ path: "start.png" });
}
function setStopIcon() {
chrome.browserAction.setIcon({ path: "stop.png" });
}
chrome.browserAction.onClicked.addListener(function(tab) {
chrome.experimental.speechInput.isRecording(function(recording) {
if (!recording) {
chrome.experimental.speechInput.start({}, function() {
if (chrome.extension.lastError) {
alert("Couldn't start speech input: " + chrome.extension.lastError.message);
setStartIcon();
} else {
setStopIcon();
}
});
} else {
chrome.experimental.speechInput.stop(function() {
setStartIcon();
});
}
});
});
chrome.experimental.speechInput.onError.addListener(function(error) {
alert("Speech input failed: " + error.code);
setStartIcon();
});
chrome.experimental.speechInput.onResult.addListener(function(result) {
alert(result.hypotheses[0].utterance);
setStartIcon();
});
</script>
<head>
<title>Speech Input API Background Page</title>
</head>
<body>
<script src="background.js"></script>
</body>
</html>
// 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.
function setStartIcon() {
chrome.browserAction.setIcon({ path: "start.png" });
}
function setStopIcon() {
chrome.browserAction.setIcon({ path: "stop.png" });
}
chrome.browserAction.onClicked.addListener(function(tab) {
chrome.experimental.speechInput.isRecording(function(recording) {
if (!recording) {
chrome.experimental.speechInput.start({}, function() {
if (chrome.extension.lastError) {
alert("Couldn't start speech input: " +
chrome.extension.lastError.message);
setStartIcon();
} else {
setStopIcon();
}
});
} else {
chrome.experimental.speechInput.stop(function() {
setStartIcon();
});
}
});
});
chrome.experimental.speechInput.onError.addListener(function(error) {
alert("Speech input failed: " + error.code);
setStartIcon();
});
chrome.experimental.speechInput.onResult.addListener(function(result) {
alert(result.hypotheses[0].utterance);
setStartIcon();
});
......@@ -12,5 +12,6 @@
"permissions": [
"experimental"
]
],
"content_security_policy": "default-src 'self'"
}
......@@ -524,7 +524,7 @@
<dd class="todo" style="display: none; ">
Undocumented.
</dd>
<dd>Settings under the "local" namespace are local to each browser.</dd>
<dd>Settings under the "local" namespace are local to each machine.</dd>
<dd style="display: none; ">
This parameter was added in version
<b><span></span></b>.
......
......@@ -3926,6 +3926,8 @@
<ul>
<li>
<code><a target="_blank" href="http://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/extensions/docs/examples/api/speechInput/basic/background.html?content-type=text/plain">background.html</a></code>
</li><li>
<code><a target="_blank" href="http://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/extensions/docs/examples/api/speechInput/basic/background.js?content-type=text/plain">background.js</a></code>
</li><li>
<code><a target="_blank" href="http://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/extensions/docs/examples/api/speechInput/basic/manifest.json?content-type=text/plain">manifest.json</a></code>
</li>
......
......@@ -2162,9 +2162,10 @@
"search_string": "SPEECH RECOGNIZER RECOGNIZES YOUR SPEECH AND TELLS YOU THE MOST LIKELY RESULT. BACKGROUND_PAGE BROWSER_ACTION EXPERIMENTAL CHROME.BROWSERACTION.ONCLICKED CHROME.BROWSERACTION.SETICON CHROME.EXPERIMENTAL.SPEECHINPUT.ISRECORDING CHROME.EXPERIMENTAL.SPEECHINPUT.ONERROR CHROME.EXPERIMENTAL.SPEECHINPUT.ONRESULT CHROME.EXPERIMENTAL.SPEECHINPUT.START CHROME.EXPERIMENTAL.SPEECHINPUT.STOP",
"source_files": [
"background.html",
"background.js",
"manifest.json"
],
"source_hash": "b092b58c922e769c003eb83e6ef4a63557ddc7f2",
"source_hash": "a3e7e6d7c8fee17bd14a56b855d40bca0c10015d",
"zip_path": "examples\/api\/speechInput\/basic.zip"
},
{
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment