michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this file, michael@0: * You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #ifndef DOM_CAMERA_DOMCAMERADETECTEDFACE_H michael@0: #define DOM_CAMERA_DOMCAMERADETECTEDFACE_H michael@0: michael@0: #include "mozilla/dom/CameraControlBinding.h" michael@0: #include "nsCycleCollectionParticipant.h" michael@0: #include "nsWrapperCache.h" michael@0: #include "mozilla/dom/DOMRect.h" michael@0: #include "ICameraControl.h" michael@0: michael@0: namespace mozilla { michael@0: michael@0: namespace dom { michael@0: michael@0: class DOMCameraPoint MOZ_FINAL : public nsISupports michael@0: , public nsWrapperCache michael@0: { michael@0: public: michael@0: NS_DECL_CYCLE_COLLECTING_ISUPPORTS michael@0: NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(DOMCameraPoint) michael@0: michael@0: // Because this header's filename doesn't match its C++ or DOM-facing michael@0: // classname, we can't rely on the [Func="..."] WebIDL tag to implicitly michael@0: // include the right header for us; instead we must explicitly include a michael@0: // HasSupport() method in each header. We can get rid of these with the michael@0: // Great Renaming proposed in bug 983177. michael@0: static bool HasSupport(JSContext* aCx, JSObject* aGlobal); michael@0: michael@0: DOMCameraPoint(nsISupports* aParent, const ICameraControl::Point& aPoint) michael@0: : mParent(aParent) michael@0: , mX(aPoint.x) michael@0: , mY(aPoint.y) michael@0: { michael@0: SetIsDOMBinding(); michael@0: } michael@0: michael@0: void michael@0: SetPoint(int32_t aX, int32_t aY) michael@0: { michael@0: mX = aX; michael@0: mY = aY; michael@0: } michael@0: michael@0: int32_t X() { return mX; } michael@0: int32_t Y() { return mY; } michael@0: michael@0: void SetX(int32_t aX) { mX = aX; } michael@0: void SetY(int32_t aY) { mY = aY; } michael@0: michael@0: nsISupports* michael@0: GetParentObject() const michael@0: { michael@0: MOZ_ASSERT(mParent); michael@0: return mParent; michael@0: } michael@0: michael@0: virtual JSObject* WrapObject(JSContext* aCx) MOZ_OVERRIDE; michael@0: michael@0: protected: michael@0: virtual ~DOMCameraPoint() { } michael@0: michael@0: nsCOMPtr mParent; michael@0: int32_t mX; michael@0: int32_t mY; michael@0: }; michael@0: michael@0: class DOMCameraDetectedFace MOZ_FINAL : public nsISupports michael@0: , public nsWrapperCache michael@0: { michael@0: public: michael@0: NS_DECL_CYCLE_COLLECTING_ISUPPORTS michael@0: NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(DOMCameraDetectedFace) michael@0: michael@0: // Because this header's filename doesn't match its C++ or DOM-facing michael@0: // classname, we can't rely on the [Func="..."] WebIDL tag to implicitly michael@0: // include the right header for us; instead we must explicitly include a michael@0: // HasSupport() method in each header. We can get rid of these with the michael@0: // Great Renaming proposed in bug 983177. michael@0: static bool HasSupport(JSContext* aCx, JSObject* aGlobal); michael@0: michael@0: DOMCameraDetectedFace(nsISupports* aParent, const ICameraControl::Face& aFace); michael@0: michael@0: uint32_t Id() { return mId; } michael@0: uint32_t Score() { return mScore; } michael@0: bool HasLeftEye() { return mLeftEye; } michael@0: bool HasRightEye() { return mRightEye; } michael@0: bool HasMouth() { return mMouth; } michael@0: michael@0: dom::DOMRect* Bounds() { return mBounds; } michael@0: michael@0: DOMCameraPoint* GetLeftEye() { return mLeftEye; } michael@0: DOMCameraPoint* GetRightEye() { return mRightEye; } michael@0: DOMCameraPoint* GetMouth() { return mMouth; } michael@0: michael@0: nsISupports* michael@0: GetParentObject() const michael@0: { michael@0: MOZ_ASSERT(mParent); michael@0: return mParent; michael@0: } michael@0: michael@0: virtual JSObject* WrapObject(JSContext* aCx) MOZ_OVERRIDE; michael@0: michael@0: protected: michael@0: virtual ~DOMCameraDetectedFace() { } michael@0: michael@0: nsCOMPtr mParent; michael@0: michael@0: uint32_t mId; michael@0: uint32_t mScore; michael@0: michael@0: nsRefPtr mBounds; michael@0: michael@0: nsRefPtr mLeftEye; michael@0: nsRefPtr mRightEye; michael@0: nsRefPtr mMouth; michael@0: }; michael@0: michael@0: } // namespace dom michael@0: michael@0: } // namespace mozilla michael@0: michael@0: #endif // DOM_CAMERA_DOMCAMERADETECTEDFACE_H