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/. */
7 #ifndef mozilla_dom_SpeechGrammarList_h
8 #define mozilla_dom_SpeechGrammarList_h
10 #include "mozilla/Attributes.h"
12 #include "nsCycleCollectionParticipant.h"
14 #include "nsWrapperCache.h"
29 class SpeechGrammarList final
: public nsISupports
, public nsWrapperCache
{
31 explicit SpeechGrammarList(nsISupports
* aParent
);
33 NS_DECL_CYCLE_COLLECTING_ISUPPORTS
34 NS_DECL_CYCLE_COLLECTION_WRAPPERCACHE_CLASS(SpeechGrammarList
)
36 static already_AddRefed
<SpeechGrammarList
> Constructor(
37 const GlobalObject
& aGlobal
);
39 static already_AddRefed
<SpeechGrammarList
> WebkitSpeechGrammarList(
40 const GlobalObject
& aGlobal
, ErrorResult
& aRv
) {
41 return Constructor(aGlobal
);
44 nsISupports
* GetParentObject() const;
46 JSObject
* WrapObject(JSContext
* aCx
,
47 JS::Handle
<JSObject
*> aGivenProto
) override
;
49 uint32_t Length() const;
51 already_AddRefed
<SpeechGrammar
> Item(uint32_t aIndex
, ErrorResult
& aRv
);
53 void AddFromURI(const nsAString
& aSrc
, const Optional
<float>& aWeight
,
56 void AddFromString(const nsAString
& aString
, const Optional
<float>& aWeight
,
59 already_AddRefed
<SpeechGrammar
> IndexedGetter(uint32_t aIndex
, bool& aPresent
,
65 nsCOMPtr
<nsISupports
> mParent
;
67 nsTArray
<RefPtr
<SpeechGrammar
>> mItems
;
71 } // namespace mozilla