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 : #ifndef mozilla_dom_MediaError_h
8 : #define mozilla_dom_MediaError_h
9 :
10 : #include "mozilla/dom/HTMLMediaElement.h"
11 : #include "nsWrapperCache.h"
12 : #include "nsISupports.h"
13 : #include "mozilla/Attributes.h"
14 :
15 : namespace mozilla {
16 : namespace dom {
17 :
18 : class MediaError final : public nsISupports,
19 : public nsWrapperCache
20 : {
21 0 : ~MediaError() {}
22 :
23 : public:
24 : MediaError(HTMLMediaElement* aParent, uint16_t aCode,
25 : const nsACString& aMessage = nsCString());
26 :
27 : // nsISupports
28 : NS_DECL_CYCLE_COLLECTING_ISUPPORTS
29 0 : NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(MediaError)
30 :
31 0 : HTMLMediaElement* GetParentObject() const
32 : {
33 0 : return mParent;
34 : }
35 :
36 : virtual JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
37 :
38 0 : uint16_t Code() const
39 : {
40 0 : return mCode;
41 : }
42 :
43 : void GetMessage(nsAString& aResult) const;
44 :
45 : private:
46 : RefPtr<HTMLMediaElement> mParent;
47 :
48 : // Error code
49 : const uint16_t mCode;
50 : // Error details;
51 : const nsCString mMessage;
52 : };
53 :
54 : } // namespace dom
55 : } // namespace mozilla
56 :
57 : #endif // mozilla_dom_MediaError_h
|