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