diff options
author | dmazzoni@chromium.org <dmazzoni@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-10-13 16:29:26 +0000 |
---|---|---|
committer | dmazzoni@chromium.org <dmazzoni@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-10-13 16:29:26 +0000 |
commit | 0e616879d117beeea7749ce6d8221521706eb3ad (patch) | |
tree | 98e37ccbccdb2d9addeb679ecada6157dfc5058f /chrome/browser/extensions/extension_tts_api.h | |
parent | 2acab7a2af503418e8d9c1cf715d63c64e79bfad (diff) | |
download | chromium_src-0e616879d117beeea7749ce6d8221521706eb3ad.zip chromium_src-0e616879d117beeea7749ce6d8221521706eb3ad.tar.gz chromium_src-0e616879d117beeea7749ce6d8221521706eb3ad.tar.bz2 |
Re-land 62283 - Refactored TTS extension code so that the platform-specific TTS
implementation code is separate from the extension API code.
That will make it easier to add more functionality that's shared
by all platforms next.
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/3640001
TBR=dmazzoni@chromium.org
Review URL: http://codereview.chromium.org/3731003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@62411 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/extensions/extension_tts_api.h')
-rw-r--r-- | chrome/browser/extensions/extension_tts_api.h | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/chrome/browser/extensions/extension_tts_api.h b/chrome/browser/extensions/extension_tts_api.h index 84fa384..73fc887 100644 --- a/chrome/browser/extensions/extension_tts_api.h +++ b/chrome/browser/extensions/extension_tts_api.h @@ -8,6 +8,46 @@ #include "chrome/browser/extensions/extension_function.h" #include "chrome/browser/extensions/extension_tts_api_util.h" +// Abstract class that defines the native platform TTS interface. +class ExtensionTtsPlatformImpl { + public: + static ExtensionTtsPlatformImpl* GetInstance(); + + // Speak the given utterance with the given parameters if possible, + // and return true on success. Utterance will always be nonempty. + // If the user does not specify the other values, language and gender + // will be empty strings, and rate, pitch, and volume will be -1.0. + virtual bool Speak( + const std::string& utterance, + const std::string& language, + const std::string& gender, + double rate, + double pitch, + double volume) = 0; + + // Stop speaking immediately and return true on success. + virtual bool StopSpeaking() = 0; + + // Return true if the synthesis engine is currently speaking. + virtual bool IsSpeaking() = 0; + + virtual std::string error() { return error_; } + virtual void clear_error() { error_ = std::string(); } + virtual void set_error(const std::string& error) { error_ = error; } + + protected: + ExtensionTtsPlatformImpl() {} + virtual ~ExtensionTtsPlatformImpl() {} + + std::string error_; + + DISALLOW_COPY_AND_ASSIGN(ExtensionTtsPlatformImpl); +}; + +// +// Extension API function definitions +// + class ExtensionTtsSpeakFunction : public SyncExtensionFunction { ~ExtensionTtsSpeakFunction() {} virtual bool RunImpl(); |