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_SpeechSynthesisParent_h michael@0: #define mozilla_dom_SpeechSynthesisParent_h michael@0: michael@0: #include "mozilla/dom/PSpeechSynthesisParent.h" michael@0: #include "mozilla/dom/PSpeechSynthesisRequestParent.h" michael@0: #include "nsSpeechTask.h" michael@0: michael@0: namespace mozilla { michael@0: namespace dom { michael@0: michael@0: class ContentParent; michael@0: class SpeechTaskParent; michael@0: class SpeechSynthesisRequestParent; michael@0: michael@0: class SpeechSynthesisParent : public PSpeechSynthesisParent michael@0: { michael@0: friend class ContentParent; michael@0: friend class SpeechSynthesisRequestParent; michael@0: michael@0: public: michael@0: bool RecvReadVoiceList(InfallibleTArray* aVoices, michael@0: InfallibleTArray* aDefaults) MOZ_OVERRIDE; michael@0: michael@0: protected: michael@0: SpeechSynthesisParent(); michael@0: virtual ~SpeechSynthesisParent(); michael@0: PSpeechSynthesisRequestParent* AllocPSpeechSynthesisRequestParent(const nsString& aText, michael@0: const nsString& aLang, michael@0: const nsString& aUri, michael@0: const float& aVolume, michael@0: const float& aRate, michael@0: const float& aPitch) michael@0: MOZ_OVERRIDE; michael@0: michael@0: bool DeallocPSpeechSynthesisRequestParent(PSpeechSynthesisRequestParent* aActor) MOZ_OVERRIDE; michael@0: michael@0: bool RecvPSpeechSynthesisRequestConstructor(PSpeechSynthesisRequestParent* aActor, michael@0: const nsString& aText, michael@0: const nsString& aLang, michael@0: const nsString& aUri, michael@0: const float& aVolume, michael@0: const float& aRate, michael@0: const float& aPitch) MOZ_OVERRIDE; michael@0: }; michael@0: michael@0: class SpeechSynthesisRequestParent : public PSpeechSynthesisRequestParent michael@0: { michael@0: public: michael@0: SpeechSynthesisRequestParent(SpeechTaskParent* aTask); michael@0: virtual ~SpeechSynthesisRequestParent(); michael@0: michael@0: nsRefPtr mTask; michael@0: michael@0: protected: michael@0: michael@0: virtual bool RecvPause() MOZ_OVERRIDE; michael@0: michael@0: virtual bool RecvResume() MOZ_OVERRIDE; michael@0: michael@0: virtual bool RecvCancel() MOZ_OVERRIDE; michael@0: }; michael@0: michael@0: class SpeechTaskParent : public nsSpeechTask michael@0: { michael@0: friend class SpeechSynthesisRequestParent; michael@0: public: michael@0: SpeechTaskParent(float aVolume, const nsAString& aUtterance) michael@0: : nsSpeechTask(aVolume, aUtterance) {} michael@0: michael@0: virtual nsresult DispatchStartImpl(); michael@0: michael@0: virtual nsresult DispatchEndImpl(float aElapsedTime, uint32_t aCharIndex); michael@0: michael@0: virtual nsresult DispatchPauseImpl(float aElapsedTime, uint32_t aCharIndex); michael@0: michael@0: virtual nsresult DispatchResumeImpl(float aElapsedTime, uint32_t aCharIndex); michael@0: michael@0: virtual nsresult DispatchErrorImpl(float aElapsedTime, uint32_t aCharIndex); michael@0: michael@0: virtual nsresult DispatchBoundaryImpl(const nsAString& aName, michael@0: float aElapsedTime, uint32_t aCharIndex); michael@0: michael@0: virtual nsresult DispatchMarkImpl(const nsAString& aName, michael@0: float aElapsedTime, uint32_t aCharIndex); michael@0: michael@0: private: michael@0: SpeechSynthesisRequestParent* mActor; michael@0: }; michael@0: michael@0: } // namespace dom michael@0: } // namespace mozilla michael@0: michael@0: #endif