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