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 : /* THIS FILE IS AUTOGENERATED FROM SpeechRecognitionEvent.webidl BY Codegen.py - DO NOT EDIT */
8 :
9 : #include "EventBinding.h"
10 : #include "SpeechRecognition.h"
11 : #include "SpeechRecognitionEvent.h"
12 : #include "SpeechRecognitionEventBinding.h"
13 : #include "js/GCAPI.h"
14 : #include "mozilla/dom/Nullable.h"
15 : #include "mozilla/dom/PrimitiveConversions.h"
16 : #include "mozilla/dom/SpeechRecognitionEvent.h"
17 : #include "mozilla/dom/SpeechRecognitionResultList.h"
18 : #include "nsIDocument.h"
19 :
20 : namespace mozilla {
21 : namespace dom {
22 :
23 :
24 : NS_IMPL_CYCLE_COLLECTION_CLASS(SpeechRecognitionEvent)
25 :
26 0 : NS_IMPL_ADDREF_INHERITED(SpeechRecognitionEvent, Event)
27 0 : NS_IMPL_RELEASE_INHERITED(SpeechRecognitionEvent, Event)
28 :
29 0 : NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(SpeechRecognitionEvent, Event)
30 0 : NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mResults)
31 0 : NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mEmma)
32 0 : NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
33 :
34 0 : NS_IMPL_CYCLE_COLLECTION_TRACE_BEGIN_INHERITED(SpeechRecognitionEvent, Event)
35 0 : NS_IMPL_CYCLE_COLLECTION_TRACE_JS_MEMBER_CALLBACK(mInterpretation)
36 0 : NS_IMPL_CYCLE_COLLECTION_TRACE_END
37 :
38 0 : NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(SpeechRecognitionEvent, Event)
39 0 : NS_IMPL_CYCLE_COLLECTION_UNLINK(mResults)
40 0 : tmp->mInterpretation.setUndefined();
41 0 : NS_IMPL_CYCLE_COLLECTION_UNLINK(mEmma)
42 0 : NS_IMPL_CYCLE_COLLECTION_UNLINK_END
43 :
44 0 : NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(SpeechRecognitionEvent)
45 0 : NS_INTERFACE_MAP_END_INHERITING(Event)
46 :
47 0 : SpeechRecognitionEvent::SpeechRecognitionEvent(mozilla::dom::EventTarget* aOwner)
48 0 : : Event(aOwner, nullptr, nullptr)
49 : {
50 0 : }
51 :
52 0 : SpeechRecognitionEvent::~SpeechRecognitionEvent()
53 : {
54 0 : mInterpretation = JS::UndefinedValue();
55 0 : mozilla::DropJSObjects(this);
56 0 : }
57 :
58 : void
59 0 : SpeechRecognitionEvent::GetInterpretation(JS::MutableHandle<JS::Value> aRetVal) const
60 : {
61 0 : JS::ExposeValueToActiveJS(mInterpretation);
62 0 : aRetVal.set(mInterpretation);
63 0 : }
64 :
65 : SpeechRecognitionEvent*
66 0 : SpeechRecognitionEvent::AsSpeechRecognitionEvent()
67 : {
68 0 : return this;
69 : }
70 :
71 : JSObject*
72 0 : SpeechRecognitionEvent::WrapObjectInternal(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
73 : {
74 0 : return SpeechRecognitionEventBinding::Wrap(aCx, this, aGivenProto);
75 : }
76 :
77 : already_AddRefed<SpeechRecognitionEvent>
78 0 : SpeechRecognitionEvent::Constructor(mozilla::dom::EventTarget* aOwner, const nsAString& aType, const SpeechRecognitionEventInit& aEventInitDict)
79 : {
80 0 : RefPtr<SpeechRecognitionEvent> e = new SpeechRecognitionEvent(aOwner);
81 0 : bool trusted = e->Init(aOwner);
82 0 : e->InitEvent(aType, aEventInitDict.mBubbles, aEventInitDict.mCancelable);
83 0 : e->mResultIndex = aEventInitDict.mResultIndex;
84 0 : e->mResults = aEventInitDict.mResults;
85 0 : e->mInterpretation = aEventInitDict.mInterpretation;
86 0 : e->mEmma = aEventInitDict.mEmma;
87 0 : e->SetTrusted(trusted);
88 0 : e->SetComposed(aEventInitDict.mComposed);
89 0 : mozilla::HoldJSObjects(e.get());
90 0 : return e.forget();
91 : }
92 :
93 : already_AddRefed<SpeechRecognitionEvent>
94 0 : SpeechRecognitionEvent::Constructor(const GlobalObject& aGlobal, const nsAString& aType, const SpeechRecognitionEventInit& aEventInitDict, ErrorResult& aRv)
95 : {
96 0 : nsCOMPtr<mozilla::dom::EventTarget> owner = do_QueryInterface(aGlobal.GetAsSupports());
97 0 : return Constructor(owner, aType, aEventInitDict);
98 : }
99 :
100 : uint32_t
101 0 : SpeechRecognitionEvent::ResultIndex() const
102 : {
103 0 : return mResultIndex;
104 : }
105 :
106 : SpeechRecognitionResultList*
107 0 : SpeechRecognitionEvent::GetResults() const
108 : {
109 0 : return mResults;
110 : }
111 :
112 : void
113 0 : SpeechRecognitionEvent::GetInterpretation(JSContext* cx, JS::MutableHandle<JS::Value> aRetVal) const
114 : {
115 0 : GetInterpretation(aRetVal);
116 0 : }
117 :
118 : nsIDocument*
119 0 : SpeechRecognitionEvent::GetEmma() const
120 : {
121 0 : return mEmma;
122 : }
123 :
124 :
125 : } // namespace dom
126 : } // namespace mozilla
|