DXR is a code search and navigation tool aimed at making sense of large projects. It supports full-text and regex searches as well as structural queries.

Implementation

Mercurial (27a812186ff4)

VCS Links

Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim:set ts=2 sw=2 sts=2 et cindent: */
/* This Source Code Form is subject to the terms of the Mozilla Public
 * 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/. */

#ifndef mozilla_dom_CameraCapabilities_h__
#define mozilla_dom_CameraCapabilities_h__

#include "nsString.h"
#include "nsAutoPtr.h"
#include "mozilla/Attributes.h"
#include "mozilla/ErrorResult.h"
#include "mozilla/dom/CameraManagerBinding.h"
#include "nsCycleCollectionParticipant.h"
#include "nsWrapperCache.h"
#include "nsPIDOMWindow.h"

struct JSContext;
class nsPIDOMWindow;

namespace mozilla {

class ICameraControl;
class RecorderProfileManager;

namespace dom {

class CameraCapabilities MOZ_FINAL : public nsISupports
                                   , public nsWrapperCache
{
public:
  NS_DECL_CYCLE_COLLECTING_ISUPPORTS
  NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(CameraCapabilities)

  CameraCapabilities(nsPIDOMWindow* aWindow);
  ~CameraCapabilities();

  nsresult Populate(ICameraControl* aCameraControl);

  nsPIDOMWindow* GetParentObject() const { return mWindow; }

  virtual JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aScope) MOZ_OVERRIDE;

  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;
  double MinExposureCompensation() const;
  double MaxExposureCompensation() const;
  double ExposureCompensationStep() const;
  JS::Value RecorderProfiles(JSContext* cx) const;
  void GetIsoModes(nsTArray<nsString>& aRetVal) const;

protected:
  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;
  nsTArray<nsString> mIsoModes;

  nsTArray<double> mZoomRatios;

  uint32_t mMaxFocusAreas;
  uint32_t mMaxMeteringAreas;

  double mMinExposureCompensation;
  double mMaxExposureCompensation;
  double mExposureCompensationStep;

  nsRefPtr<RecorderProfileManager> mRecorderProfileManager;
  JS::Heap<JS::Value> mRecorderProfiles;

  nsRefPtr<nsPIDOMWindow> mWindow;
};

} // namespace dom
} // namespace mozilla

#endif // mozilla_dom_CameraCapabilities_h__