| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_TTS_API_PLATFORM_H_ | |
| 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_TTS_API_PLATFORM_H_ | |
| 7 | |
| 8 #include <string> | |
| 9 | |
| 10 #include "chrome/browser/extensions/extension_tts_api_controller.h" | |
| 11 | |
| 12 // Abstract class that defines the native platform TTS interface, | |
| 13 // subclassed by specific implementations on Win, Mac, etc. | |
| 14 class ExtensionTtsPlatformImpl { | |
| 15 public: | |
| 16 static ExtensionTtsPlatformImpl* GetInstance(); | |
| 17 | |
| 18 // Returns true if this platform implementation is supported and available. | |
| 19 virtual bool PlatformImplAvailable() = 0; | |
| 20 | |
| 21 // Speak the given utterance with the given parameters if possible, | |
| 22 // and return true on success. Utterance will always be nonempty. | |
| 23 // If rate, pitch, or volume are -1.0, they will be ignored. | |
| 24 // | |
| 25 // The ExtensionTtsController will only try to speak one utterance at | |
| 26 // a time. If it wants to interrupt speech, it will always call Stop | |
| 27 // before speaking again. | |
| 28 virtual bool Speak( | |
| 29 int utterance_id, | |
| 30 const std::string& utterance, | |
| 31 const std::string& lang, | |
| 32 const UtteranceContinuousParameters& params) = 0; | |
| 33 | |
| 34 // Stop speaking immediately and return true on success. | |
| 35 virtual bool StopSpeaking() = 0; | |
| 36 | |
| 37 // Return true if this platform implementation will fire the given event. | |
| 38 // All platform implementations must fire the TTS_EVENT_END event at a | |
| 39 // minimum. | |
| 40 virtual bool SendsEvent(TtsEventType event_type) = 0; | |
| 41 | |
| 42 // Return the gender of the voice, should be either "male" or "female" | |
| 43 // if known, otherwise the empty string. | |
| 44 virtual std::string gender(); | |
| 45 | |
| 46 virtual std::string error(); | |
| 47 virtual void clear_error(); | |
| 48 virtual void set_error(const std::string& error); | |
| 49 | |
| 50 protected: | |
| 51 ExtensionTtsPlatformImpl() {} | |
| 52 virtual ~ExtensionTtsPlatformImpl() {} | |
| 53 | |
| 54 std::string error_; | |
| 55 | |
| 56 DISALLOW_COPY_AND_ASSIGN(ExtensionTtsPlatformImpl); | |
| 57 }; | |
| 58 | |
| 59 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_TTS_API_PLATFORM_H_ | |
| OLD | NEW |