|
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
|
2 /* vim:set ts=2 sw=2 sts=2 et cindent: */ |
|
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_CameraCapabilities_h__ |
|
8 #define mozilla_dom_CameraCapabilities_h__ |
|
9 |
|
10 #include "nsString.h" |
|
11 #include "nsAutoPtr.h" |
|
12 #include "mozilla/Attributes.h" |
|
13 #include "mozilla/ErrorResult.h" |
|
14 #include "mozilla/dom/CameraManagerBinding.h" |
|
15 #include "nsCycleCollectionParticipant.h" |
|
16 #include "nsWrapperCache.h" |
|
17 #include "nsPIDOMWindow.h" |
|
18 |
|
19 struct JSContext; |
|
20 class nsPIDOMWindow; |
|
21 |
|
22 namespace mozilla { |
|
23 |
|
24 class ICameraControl; |
|
25 class RecorderProfileManager; |
|
26 |
|
27 namespace dom { |
|
28 |
|
29 class CameraCapabilities MOZ_FINAL : public nsISupports |
|
30 , public nsWrapperCache |
|
31 { |
|
32 public: |
|
33 NS_DECL_CYCLE_COLLECTING_ISUPPORTS |
|
34 NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(CameraCapabilities) |
|
35 |
|
36 // Because this header's filename doesn't match its C++ or DOM-facing |
|
37 // classname, we can't rely on the [Func="..."] WebIDL tag to implicitly |
|
38 // include the right header for us; instead we must explicitly include a |
|
39 // HasSupport() method in each header. We can get rid of these with the |
|
40 // Great Renaming proposed in bug 983177. |
|
41 static bool HasSupport(JSContext* aCx, JSObject* aGlobal); |
|
42 |
|
43 CameraCapabilities(nsPIDOMWindow* aWindow); |
|
44 ~CameraCapabilities(); |
|
45 |
|
46 nsresult Populate(ICameraControl* aCameraControl); |
|
47 |
|
48 nsPIDOMWindow* GetParentObject() const { return mWindow; } |
|
49 |
|
50 virtual JSObject* WrapObject(JSContext* aCx) MOZ_OVERRIDE; |
|
51 |
|
52 void GetPreviewSizes(nsTArray<CameraSize>& aRetVal) const; |
|
53 void GetPictureSizes(nsTArray<CameraSize>& aRetVal) const; |
|
54 void GetThumbnailSizes(nsTArray<CameraSize>& aRetVal) const; |
|
55 void GetVideoSizes(nsTArray<CameraSize>& aRetVal) const; |
|
56 void GetFileFormats(nsTArray<nsString>& aRetVal) const; |
|
57 void GetWhiteBalanceModes(nsTArray<nsString>& aRetVal) const; |
|
58 void GetSceneModes(nsTArray<nsString>& aRetVal) const; |
|
59 void GetEffects(nsTArray<nsString>& aRetVal) const; |
|
60 void GetFlashModes(nsTArray<nsString>& aRetVal) const; |
|
61 void GetFocusModes(nsTArray<nsString>& aRetVal) const; |
|
62 void GetZoomRatios(nsTArray<double>& aRetVal) const; |
|
63 uint32_t MaxFocusAreas() const; |
|
64 uint32_t MaxMeteringAreas() const; |
|
65 uint32_t MaxDetectedFaces() const; |
|
66 double MinExposureCompensation() const; |
|
67 double MaxExposureCompensation() const; |
|
68 double ExposureCompensationStep() const; |
|
69 void GetRecorderProfiles(JSContext* aCx, JS::MutableHandle<JS::Value> aRetval) const; |
|
70 void GetIsoModes(nsTArray<nsString>& aRetVal) const; |
|
71 |
|
72 protected: |
|
73 nsresult TranslateToDictionary(ICameraControl* aCameraControl, |
|
74 uint32_t aKey, nsTArray<CameraSize>& aSizes); |
|
75 |
|
76 nsTArray<CameraSize> mPreviewSizes; |
|
77 nsTArray<CameraSize> mPictureSizes; |
|
78 nsTArray<CameraSize> mThumbnailSizes; |
|
79 nsTArray<CameraSize> mVideoSizes; |
|
80 |
|
81 nsTArray<nsString> mFileFormats; |
|
82 nsTArray<nsString> mWhiteBalanceModes; |
|
83 nsTArray<nsString> mSceneModes; |
|
84 nsTArray<nsString> mEffects; |
|
85 nsTArray<nsString> mFlashModes; |
|
86 nsTArray<nsString> mFocusModes; |
|
87 nsTArray<nsString> mIsoModes; |
|
88 |
|
89 nsTArray<double> mZoomRatios; |
|
90 |
|
91 uint32_t mMaxFocusAreas; |
|
92 uint32_t mMaxMeteringAreas; |
|
93 uint32_t mMaxDetectedFaces; |
|
94 |
|
95 double mMinExposureCompensation; |
|
96 double mMaxExposureCompensation; |
|
97 double mExposureCompensationStep; |
|
98 |
|
99 nsRefPtr<RecorderProfileManager> mRecorderProfileManager; |
|
100 JS::Heap<JS::Value> mRecorderProfiles; |
|
101 |
|
102 nsRefPtr<nsPIDOMWindow> mWindow; |
|
103 }; |
|
104 |
|
105 } // namespace dom |
|
106 } // namespace mozilla |
|
107 |
|
108 #endif // mozilla_dom_CameraCapabilities_h__ |