summaryrefslogtreecommitdiffstats
path: root/chrome/common/extensions
diff options
context:
space:
mode:
authordmazzoni@chromium.org <dmazzoni@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-11-01 16:44:57 +0000
committerdmazzoni@chromium.org <dmazzoni@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-11-01 16:44:57 +0000
commit78127e620e70c4bdf030ebd8e54598c9182b0e4e (patch)
treeac0ccc1631ea68e135b246c8d8995d7d24951eab /chrome/common/extensions
parent29ccd8e9c7a8f16e2174fdcf9f0bafe10a74db98 (diff)
downloadchromium_src-78127e620e70c4bdf030ebd8e54598c9182b0e4e.zip
chromium_src-78127e620e70c4bdf030ebd8e54598c9182b0e4e.tar.gz
chromium_src-78127e620e70c4bdf030ebd8e54598c9182b0e4e.tar.bz2
Implement Google network speech synthesis.
See bug for context. Implements a component extension that provides speech synthesis using Google's speech synthesis API. Adds a "remote" flag to the TTS and TTS Engine APIs so that it's possible for clients to distinguish between local and remote speech engines. Adds a new private extension API to expose Google's API key, needed to make the request. BUG=308250 Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=232242 Review URL: https://codereview.chromium.org/27034009 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@232412 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common/extensions')
-rw-r--r--chrome/common/extensions/api/speech/tts_engine_manifest_handler.cc10
-rw-r--r--chrome/common/extensions/api/speech/tts_engine_manifest_handler.h1
-rw-r--r--chrome/common/extensions/api/system_private.json18
-rw-r--r--chrome/common/extensions/api/tts.json5
4 files changed, 33 insertions, 1 deletions
diff --git a/chrome/common/extensions/api/speech/tts_engine_manifest_handler.cc b/chrome/common/extensions/api/speech/tts_engine_manifest_handler.cc
index bed4937..e18c594 100644
--- a/chrome/common/extensions/api/speech/tts_engine_manifest_handler.cc
+++ b/chrome/common/extensions/api/speech/tts_engine_manifest_handler.cc
@@ -29,7 +29,8 @@ struct TtsVoices : public Extension::ManifestData {
} // namespace
-TtsVoice::TtsVoice() {}
+TtsVoice::TtsVoice() : remote(false) {}
+
TtsVoice::~TtsVoice() {}
// static
@@ -95,6 +96,13 @@ bool TtsEngineManifestHandler::Parse(Extension* extension, string16* error) {
return false;
}
}
+ if (one_tts_voice->HasKey(keys::kTtsVoicesRemote)) {
+ if (!one_tts_voice->GetBoolean(
+ keys::kTtsVoicesRemote, &voice_data.remote)) {
+ *error = ASCIIToUTF16(errors::kInvalidTtsVoicesRemote);
+ return false;
+ }
+ }
if (one_tts_voice->HasKey(keys::kTtsVoicesEventTypes)) {
const base::ListValue* event_types_list;
if (!one_tts_voice->GetList(
diff --git a/chrome/common/extensions/api/speech/tts_engine_manifest_handler.h b/chrome/common/extensions/api/speech/tts_engine_manifest_handler.h
index 71d8e05..13b194b 100644
--- a/chrome/common/extensions/api/speech/tts_engine_manifest_handler.h
+++ b/chrome/common/extensions/api/speech/tts_engine_manifest_handler.h
@@ -21,6 +21,7 @@ struct TtsVoice {
std::string voice_name;
std::string lang;
std::string gender;
+ bool remote;
std::set<std::string> event_types;
static const std::vector<TtsVoice>* GetTtsVoices(const Extension* extension);
diff --git a/chrome/common/extensions/api/system_private.json b/chrome/common/extensions/api/system_private.json
index 7d95450..ea9ae38 100644
--- a/chrome/common/extensions/api/system_private.json
+++ b/chrome/common/extensions/api/system_private.json
@@ -86,6 +86,24 @@
]
}
]
+ },
+ {
+ "name": "getApiKey",
+ "type": "function",
+ "description": "Gets Chrome's API key to use for requests to Google services.",
+ "parameters": [
+ {
+ "type": "function",
+ "name": "callback",
+ "parameters": [
+ {
+ "name": "key",
+ "type": "string",
+ "description": "The API key."
+ }
+ ]
+ }
+ ]
}
],
"events": [
diff --git a/chrome/common/extensions/api/tts.json b/chrome/common/extensions/api/tts.json
index ae8771e..995968ca 100644
--- a/chrome/common/extensions/api/tts.json
+++ b/chrome/common/extensions/api/tts.json
@@ -62,6 +62,11 @@
"description": "This voice's gender.",
"enum": ["male", "female"]
},
+ "remote": {
+ "type": "boolean",
+ "optional": true,
+ "description": "If true, the synthesis engine is a remote network resource. It may be higher latency and may incur bandwidth costs."
+ },
"extensionId": {
"type": "string",
"optional": true,