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_SpeechRecognitionResult_h
8 #define mozilla_dom_SpeechRecognitionResult_h
11 #include "nsCycleCollectionParticipant.h"
12 #include "nsWrapperCache.h"
14 #include "js/TypeDecls.h"
16 #include "mozilla/Attributes.h"
18 #include "SpeechRecognitionAlternative.h"
20 namespace mozilla::dom
{
22 class SpeechRecognitionResult final
: public nsISupports
,
23 public nsWrapperCache
{
25 explicit SpeechRecognitionResult(SpeechRecognition
* aParent
);
27 NS_DECL_CYCLE_COLLECTING_ISUPPORTS
28 NS_DECL_CYCLE_COLLECTION_WRAPPERCACHE_CLASS(SpeechRecognitionResult
)
30 nsISupports
* GetParentObject() const;
32 JSObject
* WrapObject(JSContext
* aCx
,
33 JS::Handle
<JSObject
*> aGivenProto
) override
;
35 uint32_t Length() const;
37 already_AddRefed
<SpeechRecognitionAlternative
> Item(uint32_t aIndex
);
41 already_AddRefed
<SpeechRecognitionAlternative
> IndexedGetter(uint32_t aIndex
,
44 nsTArray
<RefPtr
<SpeechRecognitionAlternative
>> mItems
;
47 ~SpeechRecognitionResult();
49 RefPtr
<SpeechRecognition
> mParent
;
52 } // namespace mozilla::dom