diff options
author | dtseng@chromium.org <dtseng@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-09-15 22:33:38 +0000 |
---|---|---|
committer | dtseng@chromium.org <dtseng@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-09-15 22:33:38 +0000 |
commit | 5686e18f9855098f6b0993549e3243e4d4f7f947 (patch) | |
tree | 9c29fc0a7b16778095d0fbf716c6506a0e5356f8 /chrome/browser/extensions/extension_tts_api_util.cc | |
parent | 6827bceba32719b03a6cf49faf0b2cde17685f2f (diff) | |
download | chromium_src-5686e18f9855098f6b0993549e3243e4d4f7f947.zip chromium_src-5686e18f9855098f6b0993549e3243e4d4f7f947.tar.gz chromium_src-5686e18f9855098f6b0993549e3243e4d4f7f947.tar.bz2 |
Add support for speak properties such as rate to platform specific TTS.
BUG=none.
TEST=Use extension to drive the tts engines on Windows and Mac. Had key bindings so that verification of:
decrease rate, increase rate, decrease pitch, increase pitch, decrease volume, and increase volume worked. Verified that the limits, when reached, did not have any adverse effects.
Review URL: http://codereview.chromium.org/3325021
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@59572 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/extensions/extension_tts_api_util.cc')
-rw-r--r-- | chrome/browser/extensions/extension_tts_api_util.cc | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/chrome/browser/extensions/extension_tts_api_util.cc b/chrome/browser/extensions/extension_tts_api_util.cc new file mode 100644 index 0000000..ac5d53b --- /dev/null +++ b/chrome/browser/extensions/extension_tts_api_util.cc @@ -0,0 +1,38 @@ +// Copyright (c) 2010 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. + +#include "chrome/browser/extensions/extension_tts_api_util.h" + +namespace extension_tts_api_util { + +// Static. +bool ReadNumberByKey(DictionaryValue* dict, + const char* key, + double* ret_value) { + Value* value; + if (!dict->Get(key, &value)) + return false; + + if (value->IsType(Value::TYPE_INTEGER)) { + int int_value; + if (!dict->GetInteger(key, &int_value)) + return false; + *ret_value = int_value; + } else if (value->IsType(Value::TYPE_REAL)) { + if (!dict->GetReal(key, ret_value)) + return false; + } else { + return false; + } + return true; +} + +// Static. +void AppendSpeakOption(std::string key, + std::string value, + std::string* options) { + *options += key + kEqualStr + value + kDelimiter; +} + +} // namespace extension_tts_api_util. |