2014-02-14 14:41:07 -08:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim:set ts=2 sw=2 sts=2 et cindent: */
|
2012-09-04 18:01:56 -07:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
2014-02-14 14:41:07 -08:00
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2012-09-04 18:01:56 -07:00
|
|
|
|
2014-02-14 14:41:07 -08:00
|
|
|
#ifndef mozilla_dom_CameraCapabilities_h__
|
|
|
|
#define mozilla_dom_CameraCapabilities_h__
|
2012-09-04 18:01:56 -07:00
|
|
|
|
2014-02-14 14:41:07 -08:00
|
|
|
#include "nsString.h"
|
2012-09-04 18:01:56 -07:00
|
|
|
#include "nsAutoPtr.h"
|
2014-02-14 14:41:07 -08:00
|
|
|
#include "mozilla/Attributes.h"
|
|
|
|
#include "mozilla/ErrorResult.h"
|
|
|
|
#include "mozilla/dom/CameraManagerBinding.h"
|
|
|
|
#include "nsCycleCollectionParticipant.h"
|
|
|
|
#include "nsWrapperCache.h"
|
2014-02-27 04:54:32 -08:00
|
|
|
#include "nsPIDOMWindow.h"
|
2014-02-14 14:41:07 -08:00
|
|
|
|
|
|
|
struct JSContext;
|
|
|
|
class nsPIDOMWindow;
|
2012-09-04 18:01:56 -07:00
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
|
2014-02-14 14:41:07 -08:00
|
|
|
class ICameraControl;
|
|
|
|
class RecorderProfileManager;
|
|
|
|
|
|
|
|
namespace dom {
|
2012-09-04 18:01:56 -07:00
|
|
|
|
2014-02-14 14:41:07 -08:00
|
|
|
class CameraCapabilities MOZ_FINAL : public nsISupports
|
|
|
|
, public nsWrapperCache
|
2012-09-04 18:01:56 -07:00
|
|
|
{
|
|
|
|
public:
|
2014-02-14 14:41:07 -08:00
|
|
|
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
|
|
|
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(CameraCapabilities)
|
|
|
|
|
2014-04-09 08:53:34 -07:00
|
|
|
// Because this header's filename doesn't match its C++ or DOM-facing
|
|
|
|
// classname, we can't rely on the [Func="..."] WebIDL tag to implicitly
|
|
|
|
// include the right header for us; instead we must explicitly include a
|
|
|
|
// HasSupport() method in each header. We can get rid of these with the
|
|
|
|
// Great Renaming proposed in bug 983177.
|
|
|
|
static bool HasSupport(JSContext* aCx, JSObject* aGlobal);
|
|
|
|
|
2014-02-14 14:41:07 -08:00
|
|
|
CameraCapabilities(nsPIDOMWindow* aWindow);
|
|
|
|
|
2014-04-25 13:28:15 -07:00
|
|
|
// Populate the camera capabilities interface from the specific
|
|
|
|
// camera control object.
|
|
|
|
//
|
|
|
|
// Return values:
|
|
|
|
// - NS_OK on success;
|
|
|
|
// - NS_ERROR_INVALID_ARG if 'aCameraControl' is null.
|
2014-02-14 14:41:07 -08:00
|
|
|
nsresult Populate(ICameraControl* aCameraControl);
|
|
|
|
|
|
|
|
nsPIDOMWindow* GetParentObject() const { return mWindow; }
|
|
|
|
|
2014-04-08 15:27:18 -07:00
|
|
|
virtual JSObject* WrapObject(JSContext* aCx) MOZ_OVERRIDE;
|
2014-02-14 14:41:07 -08:00
|
|
|
|
|
|
|
void GetPreviewSizes(nsTArray<CameraSize>& aRetVal) const;
|
|
|
|
void GetPictureSizes(nsTArray<CameraSize>& aRetVal) const;
|
|
|
|
void GetThumbnailSizes(nsTArray<CameraSize>& aRetVal) const;
|
|
|
|
void GetVideoSizes(nsTArray<CameraSize>& aRetVal) const;
|
|
|
|
void GetFileFormats(nsTArray<nsString>& aRetVal) const;
|
|
|
|
void GetWhiteBalanceModes(nsTArray<nsString>& aRetVal) const;
|
|
|
|
void GetSceneModes(nsTArray<nsString>& aRetVal) const;
|
|
|
|
void GetEffects(nsTArray<nsString>& aRetVal) const;
|
|
|
|
void GetFlashModes(nsTArray<nsString>& aRetVal) const;
|
|
|
|
void GetFocusModes(nsTArray<nsString>& aRetVal) const;
|
|
|
|
void GetZoomRatios(nsTArray<double>& aRetVal) const;
|
|
|
|
uint32_t MaxFocusAreas() const;
|
|
|
|
uint32_t MaxMeteringAreas() const;
|
2014-04-09 08:52:10 -07:00
|
|
|
uint32_t MaxDetectedFaces() const;
|
2014-02-14 14:41:07 -08:00
|
|
|
double MinExposureCompensation() const;
|
|
|
|
double MaxExposureCompensation() const;
|
|
|
|
double ExposureCompensationStep() const;
|
2014-06-11 13:26:52 -07:00
|
|
|
void GetRecorderProfiles(JSContext* aCx, JS::MutableHandle<JS::Value> aRetval) const;
|
2014-03-06 22:00:43 -08:00
|
|
|
void GetIsoModes(nsTArray<nsString>& aRetVal) const;
|
2012-09-04 18:01:56 -07:00
|
|
|
|
|
|
|
protected:
|
2014-04-25 13:28:15 -07:00
|
|
|
~CameraCapabilities();
|
|
|
|
|
2014-02-14 14:41:07 -08:00
|
|
|
nsresult TranslateToDictionary(ICameraControl* aCameraControl,
|
|
|
|
uint32_t aKey, nsTArray<CameraSize>& aSizes);
|
|
|
|
|
|
|
|
nsTArray<CameraSize> mPreviewSizes;
|
|
|
|
nsTArray<CameraSize> mPictureSizes;
|
|
|
|
nsTArray<CameraSize> mThumbnailSizes;
|
|
|
|
nsTArray<CameraSize> mVideoSizes;
|
|
|
|
|
|
|
|
nsTArray<nsString> mFileFormats;
|
|
|
|
nsTArray<nsString> mWhiteBalanceModes;
|
|
|
|
nsTArray<nsString> mSceneModes;
|
|
|
|
nsTArray<nsString> mEffects;
|
|
|
|
nsTArray<nsString> mFlashModes;
|
|
|
|
nsTArray<nsString> mFocusModes;
|
2014-03-06 22:00:43 -08:00
|
|
|
nsTArray<nsString> mIsoModes;
|
2014-02-14 14:41:07 -08:00
|
|
|
|
|
|
|
nsTArray<double> mZoomRatios;
|
|
|
|
|
|
|
|
uint32_t mMaxFocusAreas;
|
|
|
|
uint32_t mMaxMeteringAreas;
|
2014-04-09 08:52:10 -07:00
|
|
|
uint32_t mMaxDetectedFaces;
|
2014-02-14 14:41:07 -08:00
|
|
|
|
|
|
|
double mMinExposureCompensation;
|
|
|
|
double mMaxExposureCompensation;
|
|
|
|
double mExposureCompensationStep;
|
|
|
|
|
|
|
|
nsRefPtr<RecorderProfileManager> mRecorderProfileManager;
|
|
|
|
JS::Heap<JS::Value> mRecorderProfiles;
|
|
|
|
|
|
|
|
nsRefPtr<nsPIDOMWindow> mWindow;
|
2012-09-04 18:01:56 -07:00
|
|
|
};
|
|
|
|
|
2014-02-14 14:41:07 -08:00
|
|
|
} // namespace dom
|
2012-09-04 18:01:56 -07:00
|
|
|
} // namespace mozilla
|
|
|
|
|
2014-02-14 14:41:07 -08:00
|
|
|
#endif // mozilla_dom_CameraCapabilities_h__
|