SpeechGrammar.h (1591B)
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_SpeechGrammar_h 8 #define mozilla_dom_SpeechGrammar_h 9 10 #include "js/TypeDecls.h" 11 #include "nsCOMPtr.h" 12 #include "nsCycleCollectionParticipant.h" 13 #include "nsString.h" 14 #include "nsWrapperCache.h" 15 16 namespace mozilla { 17 class ErrorResult; 18 19 namespace dom { 20 21 class GlobalObject; 22 23 class SpeechGrammar final : public nsISupports, public nsWrapperCache { 24 public: 25 explicit SpeechGrammar(nsISupports* aParent); 26 27 NS_DECL_CYCLE_COLLECTING_ISUPPORTS 28 NS_DECL_CYCLE_COLLECTION_WRAPPERCACHE_CLASS(SpeechGrammar) 29 30 nsISupports* GetParentObject() const; 31 32 JSObject* WrapObject(JSContext* aCx, 33 JS::Handle<JSObject*> aGivenProto) override; 34 35 static already_AddRefed<SpeechGrammar> Constructor( 36 const GlobalObject& aGlobal); 37 38 static already_AddRefed<SpeechGrammar> WebkitSpeechGrammar( 39 const GlobalObject& aGlobal, ErrorResult& aRv) { 40 return Constructor(aGlobal); 41 } 42 43 void GetSrc(nsString& aRetVal, ErrorResult& aRv) const; 44 45 void SetSrc(const nsAString& aArg, ErrorResult& aRv); 46 47 float GetWeight(ErrorResult& aRv) const; 48 49 void SetWeight(float aArg, ErrorResult& aRv); 50 51 private: 52 ~SpeechGrammar(); 53 54 nsCOMPtr<nsISupports> mParent; 55 56 nsString mSrc; 57 }; 58 59 } // namespace dom 60 } // namespace mozilla 61 62 #endif