LCOV - code coverage report
Current view: top level - dom/media/webspeech/synth - SpeechSynthesisUtterance.h (source / functions) Hit Total Coverage
Test: output.info Lines: 0 11 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 34 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
       2             : /* vim:set ts=2 sw=2 sts=2 et cindent: */
       3             : /* This Source Code Form is subject to the terms of the Mozilla Public
       4             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       5             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
       6             : 
       7             : #ifndef mozilla_dom_SpeechSynthesisUtterance_h
       8             : #define mozilla_dom_SpeechSynthesisUtterance_h
       9             : 
      10             : #include "mozilla/DOMEventTargetHelper.h"
      11             : #include "nsCOMPtr.h"
      12             : #include "nsString.h"
      13             : #include "js/TypeDecls.h"
      14             : 
      15             : #include "nsSpeechTask.h"
      16             : 
      17             : namespace mozilla {
      18             : namespace dom {
      19             : 
      20             : class SpeechSynthesisVoice;
      21             : class SpeechSynthesis;
      22             : class nsSynthVoiceRegistry;
      23             : 
      24             : class SpeechSynthesisUtterance final : public DOMEventTargetHelper
      25             : {
      26             :   friend class SpeechSynthesis;
      27             :   friend class nsSpeechTask;
      28             :   friend class nsSynthVoiceRegistry;
      29             : 
      30             : public:
      31             :   SpeechSynthesisUtterance(nsPIDOMWindowInner* aOwnerWindow, const nsAString& aText);
      32             : 
      33             :   NS_DECL_ISUPPORTS_INHERITED
      34           0 :   NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(SpeechSynthesisUtterance,
      35             :                                            DOMEventTargetHelper)
      36           0 :   NS_REALLY_FORWARD_NSIDOMEVENTTARGET(DOMEventTargetHelper)
      37             : 
      38             :   nsISupports* GetParentObject() const;
      39             : 
      40             :   JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
      41             : 
      42             :   static
      43             :   already_AddRefed<SpeechSynthesisUtterance> Constructor(GlobalObject& aGlobal,
      44             :                                                          ErrorResult& aRv);
      45             :   static
      46             :   already_AddRefed<SpeechSynthesisUtterance> Constructor(GlobalObject& aGlobal,
      47             :                                                          const nsAString& aText,
      48             :                                                          ErrorResult& aRv);
      49             : 
      50             :   void GetText(nsString& aResult) const;
      51             : 
      52             :   void SetText(const nsAString& aText);
      53             : 
      54             :   void GetLang(nsString& aResult) const;
      55             : 
      56             :   void SetLang(const nsAString& aLang);
      57             : 
      58             :   SpeechSynthesisVoice* GetVoice() const;
      59             : 
      60             :   void SetVoice(SpeechSynthesisVoice* aVoice);
      61             : 
      62             :   float Volume() const;
      63             : 
      64             :   void SetVolume(float aVolume);
      65             : 
      66             :   float Rate() const;
      67             : 
      68             :   void SetRate(float aRate);
      69             : 
      70             :   float Pitch() const;
      71             : 
      72             :   void SetPitch(float aPitch);
      73             : 
      74             :   void GetChosenVoiceURI(nsString& aResult) const;
      75             : 
      76             :   enum {
      77             :     STATE_NONE,
      78             :     STATE_PENDING,
      79             :     STATE_SPEAKING,
      80             :     STATE_ENDED
      81             :   };
      82             : 
      83           0 :   uint32_t GetState() { return mState; }
      84             : 
      85           0 :   bool IsPaused() { return mPaused; }
      86             : 
      87           0 :   IMPL_EVENT_HANDLER(start)
      88           0 :   IMPL_EVENT_HANDLER(end)
      89           0 :   IMPL_EVENT_HANDLER(error)
      90           0 :   IMPL_EVENT_HANDLER(pause)
      91           0 :   IMPL_EVENT_HANDLER(resume)
      92           0 :   IMPL_EVENT_HANDLER(mark)
      93           0 :   IMPL_EVENT_HANDLER(boundary)
      94             : 
      95             : private:
      96             :   virtual ~SpeechSynthesisUtterance();
      97             : 
      98             :   void DispatchSpeechSynthesisEvent(const nsAString& aEventType,
      99             :                                     uint32_t aCharIndex,
     100             :                                     const Nullable<uint32_t>& aCharLength,
     101             :                                     float aElapsedTime, const nsAString& aName);
     102             : 
     103             :   nsString mText;
     104             : 
     105             :   nsString mLang;
     106             : 
     107             :   float mVolume;
     108             : 
     109             :   float mRate;
     110             : 
     111             :   float mPitch;
     112             : 
     113             :   nsString mChosenVoiceURI;
     114             : 
     115             :   uint32_t mState;
     116             : 
     117             :   bool mPaused;
     118             : 
     119             :   RefPtr<SpeechSynthesisVoice> mVoice;
     120             : };
     121             : 
     122             : } // namespace dom
     123             : } // namespace mozilla
     124             : 
     125             : #endif

Generated by: LCOV version 1.13