Line data Source code
1 : /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 : /* vim: set ts=8 sts=2 et sw=2 tw=80: */
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 "SpeechRecognitionError.h"
8 :
9 : namespace mozilla {
10 : namespace dom {
11 :
12 0 : SpeechRecognitionError::SpeechRecognitionError(
13 : mozilla::dom::EventTarget* aOwner,
14 : nsPresContext* aPresContext,
15 0 : WidgetEvent* aEvent)
16 : : Event(aOwner, aPresContext, aEvent)
17 0 : , mError()
18 : {
19 0 : }
20 :
21 0 : SpeechRecognitionError::~SpeechRecognitionError() {}
22 :
23 : already_AddRefed<SpeechRecognitionError>
24 0 : SpeechRecognitionError::Constructor(const GlobalObject& aGlobal,
25 : const nsAString& aType,
26 : const SpeechRecognitionErrorInit& aParam,
27 : ErrorResult& aRv)
28 : {
29 0 : nsCOMPtr<mozilla::dom::EventTarget> t = do_QueryInterface(aGlobal.GetAsSupports());
30 0 : RefPtr<SpeechRecognitionError> e = new SpeechRecognitionError(t, nullptr, nullptr);
31 0 : bool trusted = e->Init(t);
32 0 : e->InitSpeechRecognitionError(aType, aParam.mBubbles, aParam.mCancelable, aParam.mError, aParam.mMessage);
33 0 : e->SetTrusted(trusted);
34 0 : e->SetComposed(aParam.mComposed);
35 0 : return e.forget();
36 : }
37 :
38 : void
39 0 : SpeechRecognitionError::InitSpeechRecognitionError(const nsAString& aType,
40 : bool aCanBubble,
41 : bool aCancelable,
42 : SpeechRecognitionErrorCode aError,
43 : const nsAString& aMessage)
44 : {
45 0 : Event::InitEvent(aType, aCanBubble, aCancelable);
46 0 : mError = aError;
47 0 : mMessage = aMessage;
48 0 : }
49 :
50 : } // namespace dom
51 : } // namespace mozilla
|