1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/dom/camera/DOMCameraCapabilities.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,108 @@ 1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 1.5 +/* vim:set ts=2 sw=2 sts=2 et cindent: */ 1.6 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.7 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.8 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.9 + 1.10 +#ifndef mozilla_dom_CameraCapabilities_h__ 1.11 +#define mozilla_dom_CameraCapabilities_h__ 1.12 + 1.13 +#include "nsString.h" 1.14 +#include "nsAutoPtr.h" 1.15 +#include "mozilla/Attributes.h" 1.16 +#include "mozilla/ErrorResult.h" 1.17 +#include "mozilla/dom/CameraManagerBinding.h" 1.18 +#include "nsCycleCollectionParticipant.h" 1.19 +#include "nsWrapperCache.h" 1.20 +#include "nsPIDOMWindow.h" 1.21 + 1.22 +struct JSContext; 1.23 +class nsPIDOMWindow; 1.24 + 1.25 +namespace mozilla { 1.26 + 1.27 +class ICameraControl; 1.28 +class RecorderProfileManager; 1.29 + 1.30 +namespace dom { 1.31 + 1.32 +class CameraCapabilities MOZ_FINAL : public nsISupports 1.33 + , public nsWrapperCache 1.34 +{ 1.35 +public: 1.36 + NS_DECL_CYCLE_COLLECTING_ISUPPORTS 1.37 + NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(CameraCapabilities) 1.38 + 1.39 + // Because this header's filename doesn't match its C++ or DOM-facing 1.40 + // classname, we can't rely on the [Func="..."] WebIDL tag to implicitly 1.41 + // include the right header for us; instead we must explicitly include a 1.42 + // HasSupport() method in each header. We can get rid of these with the 1.43 + // Great Renaming proposed in bug 983177. 1.44 + static bool HasSupport(JSContext* aCx, JSObject* aGlobal); 1.45 + 1.46 + CameraCapabilities(nsPIDOMWindow* aWindow); 1.47 + ~CameraCapabilities(); 1.48 + 1.49 + nsresult Populate(ICameraControl* aCameraControl); 1.50 + 1.51 + nsPIDOMWindow* GetParentObject() const { return mWindow; } 1.52 + 1.53 + virtual JSObject* WrapObject(JSContext* aCx) MOZ_OVERRIDE; 1.54 + 1.55 + void GetPreviewSizes(nsTArray<CameraSize>& aRetVal) const; 1.56 + void GetPictureSizes(nsTArray<CameraSize>& aRetVal) const; 1.57 + void GetThumbnailSizes(nsTArray<CameraSize>& aRetVal) const; 1.58 + void GetVideoSizes(nsTArray<CameraSize>& aRetVal) const; 1.59 + void GetFileFormats(nsTArray<nsString>& aRetVal) const; 1.60 + void GetWhiteBalanceModes(nsTArray<nsString>& aRetVal) const; 1.61 + void GetSceneModes(nsTArray<nsString>& aRetVal) const; 1.62 + void GetEffects(nsTArray<nsString>& aRetVal) const; 1.63 + void GetFlashModes(nsTArray<nsString>& aRetVal) const; 1.64 + void GetFocusModes(nsTArray<nsString>& aRetVal) const; 1.65 + void GetZoomRatios(nsTArray<double>& aRetVal) const; 1.66 + uint32_t MaxFocusAreas() const; 1.67 + uint32_t MaxMeteringAreas() const; 1.68 + uint32_t MaxDetectedFaces() const; 1.69 + double MinExposureCompensation() const; 1.70 + double MaxExposureCompensation() const; 1.71 + double ExposureCompensationStep() const; 1.72 + void GetRecorderProfiles(JSContext* aCx, JS::MutableHandle<JS::Value> aRetval) const; 1.73 + void GetIsoModes(nsTArray<nsString>& aRetVal) const; 1.74 + 1.75 +protected: 1.76 + nsresult TranslateToDictionary(ICameraControl* aCameraControl, 1.77 + uint32_t aKey, nsTArray<CameraSize>& aSizes); 1.78 + 1.79 + nsTArray<CameraSize> mPreviewSizes; 1.80 + nsTArray<CameraSize> mPictureSizes; 1.81 + nsTArray<CameraSize> mThumbnailSizes; 1.82 + nsTArray<CameraSize> mVideoSizes; 1.83 + 1.84 + nsTArray<nsString> mFileFormats; 1.85 + nsTArray<nsString> mWhiteBalanceModes; 1.86 + nsTArray<nsString> mSceneModes; 1.87 + nsTArray<nsString> mEffects; 1.88 + nsTArray<nsString> mFlashModes; 1.89 + nsTArray<nsString> mFocusModes; 1.90 + nsTArray<nsString> mIsoModes; 1.91 + 1.92 + nsTArray<double> mZoomRatios; 1.93 + 1.94 + uint32_t mMaxFocusAreas; 1.95 + uint32_t mMaxMeteringAreas; 1.96 + uint32_t mMaxDetectedFaces; 1.97 + 1.98 + double mMinExposureCompensation; 1.99 + double mMaxExposureCompensation; 1.100 + double mExposureCompensationStep; 1.101 + 1.102 + nsRefPtr<RecorderProfileManager> mRecorderProfileManager; 1.103 + JS::Heap<JS::Value> mRecorderProfiles; 1.104 + 1.105 + nsRefPtr<nsPIDOMWindow> mWindow; 1.106 +}; 1.107 + 1.108 +} // namespace dom 1.109 +} // namespace mozilla 1.110 + 1.111 +#endif // mozilla_dom_CameraCapabilities_h__