|
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 #include "SpeechRecognitionAlternative.h" |
|
8 |
|
9 #include "mozilla/dom/SpeechRecognitionAlternativeBinding.h" |
|
10 |
|
11 #include "SpeechRecognition.h" |
|
12 |
|
13 namespace mozilla { |
|
14 namespace dom { |
|
15 |
|
16 NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE_1(SpeechRecognitionAlternative, mParent) |
|
17 NS_IMPL_CYCLE_COLLECTING_ADDREF(SpeechRecognitionAlternative) |
|
18 NS_IMPL_CYCLE_COLLECTING_RELEASE(SpeechRecognitionAlternative) |
|
19 NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(SpeechRecognitionAlternative) |
|
20 NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY |
|
21 NS_INTERFACE_MAP_ENTRY(nsISupports) |
|
22 NS_INTERFACE_MAP_END |
|
23 |
|
24 SpeechRecognitionAlternative::SpeechRecognitionAlternative(SpeechRecognition* aParent) |
|
25 : mTranscript(NS_LITERAL_STRING("")) |
|
26 , mConfidence(0) |
|
27 , mParent(aParent) |
|
28 { |
|
29 SetIsDOMBinding(); |
|
30 } |
|
31 |
|
32 SpeechRecognitionAlternative::~SpeechRecognitionAlternative() |
|
33 { |
|
34 } |
|
35 |
|
36 JSObject* |
|
37 SpeechRecognitionAlternative::WrapObject(JSContext* aCx) |
|
38 { |
|
39 return SpeechRecognitionAlternativeBinding::Wrap(aCx, this); |
|
40 } |
|
41 |
|
42 nsISupports* |
|
43 SpeechRecognitionAlternative::GetParentObject() const |
|
44 { |
|
45 return static_cast<DOMEventTargetHelper*>(mParent.get()); |
|
46 } |
|
47 |
|
48 void |
|
49 SpeechRecognitionAlternative::GetTranscript(nsString& aRetVal) const |
|
50 { |
|
51 aRetVal = mTranscript; |
|
52 } |
|
53 |
|
54 float |
|
55 SpeechRecognitionAlternative::Confidence() const |
|
56 { |
|
57 return mConfidence; |
|
58 } |
|
59 } // namespace dom |
|
60 } // namespace mozilla |