dom/camera/DOMCameraCapabilities.h

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.

     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/. */
     7 #ifndef mozilla_dom_CameraCapabilities_h__
     8 #define mozilla_dom_CameraCapabilities_h__
    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"
    19 struct JSContext;
    20 class nsPIDOMWindow;
    22 namespace mozilla {
    24 class ICameraControl;
    25 class RecorderProfileManager;
    27 namespace dom {
    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)
    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);
    43   CameraCapabilities(nsPIDOMWindow* aWindow);
    44   ~CameraCapabilities();
    46   nsresult Populate(ICameraControl* aCameraControl);
    48   nsPIDOMWindow* GetParentObject() const { return mWindow; }
    50   virtual JSObject* WrapObject(JSContext* aCx) MOZ_OVERRIDE;
    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;
    72 protected:
    73   nsresult TranslateToDictionary(ICameraControl* aCameraControl,
    74                                  uint32_t aKey, nsTArray<CameraSize>& aSizes);
    76   nsTArray<CameraSize> mPreviewSizes;
    77   nsTArray<CameraSize> mPictureSizes;
    78   nsTArray<CameraSize> mThumbnailSizes;
    79   nsTArray<CameraSize> mVideoSizes;
    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;
    89   nsTArray<double> mZoomRatios;
    91   uint32_t mMaxFocusAreas;
    92   uint32_t mMaxMeteringAreas;
    93   uint32_t mMaxDetectedFaces;
    95   double mMinExposureCompensation;
    96   double mMaxExposureCompensation;
    97   double mExposureCompensationStep;
    99   nsRefPtr<RecorderProfileManager> mRecorderProfileManager;
   100   JS::Heap<JS::Value> mRecorderProfiles;
   102   nsRefPtr<nsPIDOMWindow> mWindow;
   103 };
   105 } // namespace dom
   106 } // namespace mozilla
   108 #endif // mozilla_dom_CameraCapabilities_h__

mercurial