Index: chrome/browser/speech/tts_controller.h |
diff --git a/chrome/browser/speech/tts_controller.h b/chrome/browser/speech/tts_controller.h |
index a479a96c69ae4de7b47aa14d20472812c358a247..118ca199cf1055d7a345b1a70a116a5bd4a62381 100644 |
--- a/chrome/browser/speech/tts_controller.h |
+++ b/chrome/browser/speech/tts_controller.h |
@@ -8,16 +8,17 @@ |
#include <queue> |
#include <set> |
#include <string> |
+#include <vector> |
#include "base/memory/scoped_ptr.h" |
#include "base/memory/singleton.h" |
#include "googleurl/src/gurl.h" |
+class Utterance; |
class TtsPlatformImpl; |
class Profile; |
namespace base { |
-class ListValue; |
class Value; |
} |
@@ -34,6 +35,11 @@ enum TtsEventType { |
}; |
tommi (sloooow) - chröme
2013/03/07 13:04:46
nit: one empty line is fine as a separator (here a
dmazzoni
2013/03/19 17:30:22
Done.
|
+// Returns true if this event type is one that indicates an utterance |
+// is finished and can be destroyed. |
+bool IsFinalTtsEventType(TtsEventType event_type); |
+ |
+ |
// The continuous parameters that apply to a given utterance. |
struct UtteranceContinuousParameters { |
UtteranceContinuousParameters(); |
@@ -44,6 +50,30 @@ struct UtteranceContinuousParameters { |
}; |
+// Information about one voice. |
+struct VoiceData { |
+ VoiceData(); |
+ ~VoiceData(); |
+ |
+ std::string name; |
+ std::string lang; |
+ std::string gender; |
+ std::string extension_id; |
+ std::vector<std::string> events; |
+}; |
+ |
+ |
+// Class that wants to receive events on utterances. |
+class UtteranceEventDelegate { |
+ public: |
+ virtual ~UtteranceEventDelegate() {} |
+ virtual void OnTtsEvent(Utterance* utterance, |
+ TtsEventType event_type, |
+ int char_index, |
+ const std::string& error_message) = 0; |
+}; |
+ |
+ |
// One speech utterance. |
class Utterance { |
public: |
@@ -125,6 +155,11 @@ class Utterance { |
extension_id_ = extension_id; |
} |
+ UtteranceEventDelegate* event_delegate() const { return event_delegate_; } |
+ void set_event_delegate(UtteranceEventDelegate* event_delegate) { |
+ event_delegate_ = event_delegate; |
+ } |
+ |
// Getters and setters for internal state. |
Profile* profile() const { return profile_; } |
int id() const { return id_; } |
@@ -164,6 +199,9 @@ class Utterance { |
// The URL of the page where the source extension called speak. |
GURL src_url_; |
+ // The delegate to be called when an utterance event is fired. |
+ UtteranceEventDelegate* event_delegate_; |
tommi (sloooow) - chröme
2013/03/07 13:04:46
document ownership?
dmazzoni
2013/03/19 17:30:22
Done.
|
+ |
// The parsed options. |
std::string voice_name_; |
std::string lang_; |
@@ -212,7 +250,7 @@ class TtsController { |
// Return a list of all available voices, including the native voice, |
// if supported, and all voices registered by extensions. |
- base::ListValue* GetVoices(Profile* profile); |
+ void GetVoices(Profile* profile, std::vector<VoiceData>* out_voices); |
// Called by TtsExtensionLoaderChromeOs::LoadTtsExtension when it |
// finishes loading the built-in TTS component extension. |