dom/camera/DOMCameraDetectedFace.h

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 2 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
michael@0 3 * You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 4
michael@0 5 #ifndef DOM_CAMERA_DOMCAMERADETECTEDFACE_H
michael@0 6 #define DOM_CAMERA_DOMCAMERADETECTEDFACE_H
michael@0 7
michael@0 8 #include "mozilla/dom/CameraControlBinding.h"
michael@0 9 #include "nsCycleCollectionParticipant.h"
michael@0 10 #include "nsWrapperCache.h"
michael@0 11 #include "mozilla/dom/DOMRect.h"
michael@0 12 #include "ICameraControl.h"
michael@0 13
michael@0 14 namespace mozilla {
michael@0 15
michael@0 16 namespace dom {
michael@0 17
michael@0 18 class DOMCameraPoint MOZ_FINAL : public nsISupports
michael@0 19 , public nsWrapperCache
michael@0 20 {
michael@0 21 public:
michael@0 22 NS_DECL_CYCLE_COLLECTING_ISUPPORTS
michael@0 23 NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(DOMCameraPoint)
michael@0 24
michael@0 25 // Because this header's filename doesn't match its C++ or DOM-facing
michael@0 26 // classname, we can't rely on the [Func="..."] WebIDL tag to implicitly
michael@0 27 // include the right header for us; instead we must explicitly include a
michael@0 28 // HasSupport() method in each header. We can get rid of these with the
michael@0 29 // Great Renaming proposed in bug 983177.
michael@0 30 static bool HasSupport(JSContext* aCx, JSObject* aGlobal);
michael@0 31
michael@0 32 DOMCameraPoint(nsISupports* aParent, const ICameraControl::Point& aPoint)
michael@0 33 : mParent(aParent)
michael@0 34 , mX(aPoint.x)
michael@0 35 , mY(aPoint.y)
michael@0 36 {
michael@0 37 SetIsDOMBinding();
michael@0 38 }
michael@0 39
michael@0 40 void
michael@0 41 SetPoint(int32_t aX, int32_t aY)
michael@0 42 {
michael@0 43 mX = aX;
michael@0 44 mY = aY;
michael@0 45 }
michael@0 46
michael@0 47 int32_t X() { return mX; }
michael@0 48 int32_t Y() { return mY; }
michael@0 49
michael@0 50 void SetX(int32_t aX) { mX = aX; }
michael@0 51 void SetY(int32_t aY) { mY = aY; }
michael@0 52
michael@0 53 nsISupports*
michael@0 54 GetParentObject() const
michael@0 55 {
michael@0 56 MOZ_ASSERT(mParent);
michael@0 57 return mParent;
michael@0 58 }
michael@0 59
michael@0 60 virtual JSObject* WrapObject(JSContext* aCx) MOZ_OVERRIDE;
michael@0 61
michael@0 62 protected:
michael@0 63 virtual ~DOMCameraPoint() { }
michael@0 64
michael@0 65 nsCOMPtr<nsISupports> mParent;
michael@0 66 int32_t mX;
michael@0 67 int32_t mY;
michael@0 68 };
michael@0 69
michael@0 70 class DOMCameraDetectedFace MOZ_FINAL : public nsISupports
michael@0 71 , public nsWrapperCache
michael@0 72 {
michael@0 73 public:
michael@0 74 NS_DECL_CYCLE_COLLECTING_ISUPPORTS
michael@0 75 NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(DOMCameraDetectedFace)
michael@0 76
michael@0 77 // Because this header's filename doesn't match its C++ or DOM-facing
michael@0 78 // classname, we can't rely on the [Func="..."] WebIDL tag to implicitly
michael@0 79 // include the right header for us; instead we must explicitly include a
michael@0 80 // HasSupport() method in each header. We can get rid of these with the
michael@0 81 // Great Renaming proposed in bug 983177.
michael@0 82 static bool HasSupport(JSContext* aCx, JSObject* aGlobal);
michael@0 83
michael@0 84 DOMCameraDetectedFace(nsISupports* aParent, const ICameraControl::Face& aFace);
michael@0 85
michael@0 86 uint32_t Id() { return mId; }
michael@0 87 uint32_t Score() { return mScore; }
michael@0 88 bool HasLeftEye() { return mLeftEye; }
michael@0 89 bool HasRightEye() { return mRightEye; }
michael@0 90 bool HasMouth() { return mMouth; }
michael@0 91
michael@0 92 dom::DOMRect* Bounds() { return mBounds; }
michael@0 93
michael@0 94 DOMCameraPoint* GetLeftEye() { return mLeftEye; }
michael@0 95 DOMCameraPoint* GetRightEye() { return mRightEye; }
michael@0 96 DOMCameraPoint* GetMouth() { return mMouth; }
michael@0 97
michael@0 98 nsISupports*
michael@0 99 GetParentObject() const
michael@0 100 {
michael@0 101 MOZ_ASSERT(mParent);
michael@0 102 return mParent;
michael@0 103 }
michael@0 104
michael@0 105 virtual JSObject* WrapObject(JSContext* aCx) MOZ_OVERRIDE;
michael@0 106
michael@0 107 protected:
michael@0 108 virtual ~DOMCameraDetectedFace() { }
michael@0 109
michael@0 110 nsCOMPtr<nsISupports> mParent;
michael@0 111
michael@0 112 uint32_t mId;
michael@0 113 uint32_t mScore;
michael@0 114
michael@0 115 nsRefPtr<dom::DOMRect> mBounds;
michael@0 116
michael@0 117 nsRefPtr<DOMCameraPoint> mLeftEye;
michael@0 118 nsRefPtr<DOMCameraPoint> mRightEye;
michael@0 119 nsRefPtr<DOMCameraPoint> mMouth;
michael@0 120 };
michael@0 121
michael@0 122 } // namespace dom
michael@0 123
michael@0 124 } // namespace mozilla
michael@0 125
michael@0 126 #endif // DOM_CAMERA_DOMCAMERADETECTEDFACE_H

mercurial