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_ImageCaptureError_h
8 : #define mozilla_dom_ImageCaptureError_h
9 :
10 : #include "mozilla/Attributes.h"
11 : #include "nsCOMPtr.h"
12 : #include "nsString.h"
13 : #include "nsWrapperCache.h"
14 :
15 : namespace mozilla {
16 : namespace dom {
17 :
18 : /**
19 : * This is the implementation of ImageCaptureError on W3C specification
20 : * https://dvcs.w3.org/hg/dap/raw-file/default/media-stream-capture/ImageCapture.html#idl-def-ImageCaptureError.
21 : * This object should be generated by ImageCapture object only.
22 : */
23 : class ImageCaptureError final : public nsISupports,
24 : public nsWrapperCache
25 : {
26 : public:
27 : NS_DECL_CYCLE_COLLECTING_ISUPPORTS
28 0 : NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(ImageCaptureError)
29 :
30 : ImageCaptureError(nsISupports* aParent, uint16_t aCode, const nsAString& aMessage);
31 :
32 : nsISupports* GetParentObject() const;
33 :
34 : virtual JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
35 :
36 : uint16_t Code() const;
37 :
38 : enum {
39 : FRAME_GRAB_ERROR = 1,
40 : SETTINGS_ERROR = 2,
41 : PHOTO_ERROR = 3,
42 : ERROR_UNKNOWN = 4,
43 : };
44 :
45 : void GetMessage(nsAString& retval) const;
46 :
47 : private:
48 : ~ImageCaptureError();
49 :
50 : nsCOMPtr<nsISupports> mParent;
51 : nsString mMessage;
52 : uint16_t mCode;
53 : };
54 :
55 : } // namespace dom
56 : } // namespace mozilla
57 :
58 : #endif // mozilla_dom_ImageCaptureError_h
|