michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this file, michael@0: * You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #ifndef mozilla_dom_SpeechSynthesisChild_h michael@0: #define mozilla_dom_SpeechSynthesisChild_h michael@0: michael@0: #include "mozilla/Attributes.h" michael@0: #include "mozilla/dom/PSpeechSynthesisChild.h" michael@0: #include "mozilla/dom/PSpeechSynthesisRequestChild.h" michael@0: #include "nsSpeechTask.h" michael@0: michael@0: namespace mozilla { michael@0: namespace dom { michael@0: michael@0: class nsSynthVoiceRegistry; michael@0: class SpeechSynthesisRequestChild; michael@0: class SpeechTaskChild; michael@0: michael@0: class SpeechSynthesisChild : public PSpeechSynthesisChild michael@0: { michael@0: friend class nsSynthVoiceRegistry; michael@0: michael@0: public: michael@0: bool RecvVoiceAdded(const RemoteVoice& aVoice) MOZ_OVERRIDE; michael@0: michael@0: bool RecvVoiceRemoved(const nsString& aUri) MOZ_OVERRIDE; michael@0: michael@0: bool RecvSetDefaultVoice(const nsString& aUri, const bool& aIsDefault) MOZ_OVERRIDE; michael@0: michael@0: protected: michael@0: SpeechSynthesisChild(); michael@0: virtual ~SpeechSynthesisChild(); michael@0: michael@0: PSpeechSynthesisRequestChild* AllocPSpeechSynthesisRequestChild(const nsString& aLang, michael@0: const nsString& aUri, michael@0: const nsString& aText, michael@0: const float& aVolume, michael@0: const float& aPitch, michael@0: const float& aRate) MOZ_OVERRIDE; michael@0: bool DeallocPSpeechSynthesisRequestChild(PSpeechSynthesisRequestChild* aActor) MOZ_OVERRIDE; michael@0: }; michael@0: michael@0: class SpeechSynthesisRequestChild : public PSpeechSynthesisRequestChild michael@0: { michael@0: public: michael@0: SpeechSynthesisRequestChild(SpeechTaskChild* aTask); michael@0: virtual ~SpeechSynthesisRequestChild(); michael@0: michael@0: protected: michael@0: virtual bool RecvOnStart() MOZ_OVERRIDE; michael@0: michael@0: virtual bool Recv__delete__(const bool& aIsError, michael@0: const float& aElapsedTime, michael@0: const uint32_t& aCharIndex) MOZ_OVERRIDE; michael@0: michael@0: virtual bool RecvOnPause(const float& aElapsedTime, const uint32_t& aCharIndex) MOZ_OVERRIDE; michael@0: michael@0: virtual bool RecvOnResume(const float& aElapsedTime, const uint32_t& aCharIndex) MOZ_OVERRIDE; michael@0: michael@0: virtual bool RecvOnBoundary(const nsString& aName, const float& aElapsedTime, michael@0: const uint32_t& aCharIndex) MOZ_OVERRIDE; michael@0: michael@0: virtual bool RecvOnMark(const nsString& aName, const float& aElapsedTime, michael@0: const uint32_t& aCharIndex) MOZ_OVERRIDE; michael@0: michael@0: nsRefPtr mTask; michael@0: }; michael@0: michael@0: class SpeechTaskChild : public nsSpeechTask michael@0: { michael@0: friend class SpeechSynthesisRequestChild; michael@0: public: michael@0: michael@0: SpeechTaskChild(SpeechSynthesisUtterance* aUtterance); michael@0: michael@0: NS_IMETHOD Setup(nsISpeechTaskCallback* aCallback, michael@0: uint32_t aChannels, uint32_t aRate, uint8_t argc) MOZ_OVERRIDE; michael@0: michael@0: NS_IMETHOD SendAudio(JS::Handle aData, JS::Handle aLandmarks, michael@0: JSContext* aCx) MOZ_OVERRIDE; michael@0: michael@0: NS_IMETHOD SendAudioNative(int16_t* aData, uint32_t aDataLen) MOZ_OVERRIDE; michael@0: michael@0: virtual void Pause(); michael@0: michael@0: virtual void Resume(); michael@0: michael@0: virtual void Cancel(); michael@0: michael@0: private: michael@0: SpeechSynthesisRequestChild* mActor; michael@0: }; michael@0: michael@0: } // namespace dom michael@0: } // namespace mozilla michael@0: michael@0: #endif