tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

SpeechRecognitionAlternative.cpp (1594B)


      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 "SpeechRecognition.h"
     10 #include "mozilla/dom/SpeechRecognitionAlternativeBinding.h"
     11 
     12 namespace mozilla::dom {
     13 
     14 NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(SpeechRecognitionAlternative, mParent)
     15 NS_IMPL_CYCLE_COLLECTING_ADDREF(SpeechRecognitionAlternative)
     16 NS_IMPL_CYCLE_COLLECTING_RELEASE(SpeechRecognitionAlternative)
     17 NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(SpeechRecognitionAlternative)
     18  NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
     19  NS_INTERFACE_MAP_ENTRY(nsISupports)
     20 NS_INTERFACE_MAP_END
     21 
     22 SpeechRecognitionAlternative::SpeechRecognitionAlternative(
     23    SpeechRecognition* aParent)
     24    : mConfidence(0), mParent(aParent) {}
     25 
     26 SpeechRecognitionAlternative::~SpeechRecognitionAlternative() = default;
     27 
     28 JSObject* SpeechRecognitionAlternative::WrapObject(
     29    JSContext* aCx, JS::Handle<JSObject*> aGivenProto) {
     30  return SpeechRecognitionAlternative_Binding::Wrap(aCx, this, aGivenProto);
     31 }
     32 
     33 nsISupports* SpeechRecognitionAlternative::GetParentObject() const {
     34  return static_cast<EventTarget*>(mParent.get());
     35 }
     36 
     37 void SpeechRecognitionAlternative::GetTranscript(nsString& aRetVal) const {
     38  aRetVal = mTranscript;
     39 }
     40 
     41 float SpeechRecognitionAlternative::Confidence() const { return mConfidence; }
     42 
     43 }  // namespace mozilla::dom