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_SpeechRecognitionResultList_h
8 : #define mozilla_dom_SpeechRecognitionResultList_h
9 :
10 : #include "nsCycleCollectionParticipant.h"
11 : #include "nsWrapperCache.h"
12 : #include "nsTArray.h"
13 : #include "js/TypeDecls.h"
14 :
15 : #include "mozilla/Attributes.h"
16 :
17 : #include "SpeechRecognitionResult.h"
18 :
19 : namespace mozilla {
20 : namespace dom {
21 :
22 : class SpeechRecognition;
23 :
24 : class SpeechRecognitionResultList final : public nsISupports,
25 : public nsWrapperCache
26 : {
27 : public:
28 : explicit SpeechRecognitionResultList(SpeechRecognition* aParent);
29 :
30 : NS_DECL_CYCLE_COLLECTING_ISUPPORTS
31 0 : NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(SpeechRecognitionResultList)
32 :
33 : nsISupports* GetParentObject() const;
34 :
35 : JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
36 :
37 : uint32_t Length() const;
38 :
39 : already_AddRefed<SpeechRecognitionResult> Item(uint32_t aIndex);
40 :
41 : already_AddRefed<SpeechRecognitionResult> IndexedGetter(uint32_t aIndex, bool& aPresent);
42 :
43 : nsTArray<RefPtr<SpeechRecognitionResult>> mItems;
44 : private:
45 : ~SpeechRecognitionResultList();
46 :
47 : RefPtr<SpeechRecognition> mParent;
48 : };
49 :
50 : } // namespace dom
51 : } // namespace mozilla
52 :
53 : #endif
|