dom/quota/OriginOrPatternString.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.

michael@0 1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
michael@0 2 /* vim: set ts=2 et sw=2 tw=80: */
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 file,
michael@0 5 * You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 6
michael@0 7 #ifndef mozilla_dom_quota_originorpatternstring_h__
michael@0 8 #define mozilla_dom_quota_originorpatternstring_h__
michael@0 9
michael@0 10 #include "mozilla/dom/quota/QuotaCommon.h"
michael@0 11
michael@0 12 BEGIN_QUOTA_NAMESPACE
michael@0 13
michael@0 14 class OriginOrPatternString : public nsCString
michael@0 15 {
michael@0 16 public:
michael@0 17 static OriginOrPatternString
michael@0 18 FromOrigin(const nsACString& aOrigin)
michael@0 19 {
michael@0 20 return OriginOrPatternString(aOrigin, true);
michael@0 21 }
michael@0 22
michael@0 23 static OriginOrPatternString
michael@0 24 FromPattern(const nsACString& aPattern)
michael@0 25 {
michael@0 26 return OriginOrPatternString(aPattern, false);
michael@0 27 }
michael@0 28
michael@0 29 static OriginOrPatternString
michael@0 30 FromNull()
michael@0 31 {
michael@0 32 return OriginOrPatternString();
michael@0 33 }
michael@0 34
michael@0 35 bool
michael@0 36 IsOrigin() const
michael@0 37 {
michael@0 38 return mIsOrigin;
michael@0 39 }
michael@0 40
michael@0 41 bool
michael@0 42 IsPattern() const
michael@0 43 {
michael@0 44 return mIsPattern;
michael@0 45 }
michael@0 46
michael@0 47 bool
michael@0 48 IsNull() const
michael@0 49 {
michael@0 50 return mIsNull;
michael@0 51 }
michael@0 52
michael@0 53 private:
michael@0 54 OriginOrPatternString(const nsACString& aOriginOrPattern, bool aIsOrigin)
michael@0 55 : nsCString(aOriginOrPattern),
michael@0 56 mIsOrigin(aIsOrigin), mIsPattern(!aIsOrigin), mIsNull(false)
michael@0 57 { }
michael@0 58
michael@0 59 OriginOrPatternString()
michael@0 60 : mIsOrigin(false), mIsPattern(false), mIsNull(true)
michael@0 61 { }
michael@0 62
michael@0 63 bool
michael@0 64 operator==(const OriginOrPatternString& aOther) MOZ_DELETE;
michael@0 65
michael@0 66 bool mIsOrigin;
michael@0 67 bool mIsPattern;
michael@0 68 bool mIsNull;
michael@0 69 };
michael@0 70
michael@0 71 END_QUOTA_NAMESPACE
michael@0 72
michael@0 73 #endif // mozilla_dom_quota_originorpatternstring_h__

mercurial