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