intl/strres/src/nsStringBundle.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: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
     2 /* This Source Code Form is subject to the terms of the Mozilla Public
     3  * License, v. 2.0. If a copy of the MPL was not distributed with this
     4  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     6 #ifndef nsStringBundle_h__
     7 #define nsStringBundle_h__
     9 #include "mozilla/ReentrantMonitor.h"
    10 #include "nsIStringBundle.h"
    11 #include "nsCOMPtr.h"
    12 #include "nsString.h"
    13 #include "nsCOMArray.h"
    15 class nsIPersistentProperties;
    16 class nsIStringBundleOverride;
    18 class nsStringBundle : public nsIStringBundle
    19 {
    20 public:
    21     // init version
    22     nsStringBundle(const char* aURLSpec, nsIStringBundleOverride*);
    23     nsresult LoadProperties();
    24     virtual ~nsStringBundle();
    26     NS_DECL_THREADSAFE_ISUPPORTS
    27     NS_DECL_NSISTRINGBUNDLE
    29     nsCOMPtr<nsIPersistentProperties> mProps;
    31 protected:
    32     //
    33     // functional decomposition of the funitions repeatively called
    34     //
    35     nsresult GetStringFromID(int32_t aID, nsAString& aResult);
    36     nsresult GetStringFromName(const nsAString& aName, nsAString& aResult);
    38     nsresult GetCombinedEnumeration(nsIStringBundleOverride* aOverrideString,
    39                                     nsISimpleEnumerator** aResult);
    40 private:
    41     nsCString              mPropertiesURL;
    42     nsCOMPtr<nsIStringBundleOverride> mOverrideStrings;
    43     mozilla::ReentrantMonitor    mReentrantMonitor;
    44     bool                         mAttemptedLoad;
    45     bool                         mLoaded;
    47 public:
    48     static nsresult FormatString(const char16_t *formatStr,
    49                                  const char16_t **aParams, uint32_t aLength,
    50                                  char16_t **aResult);
    51 };
    53 /**
    54  * An extensible implementation of the StringBundle interface.
    55  *
    56  * @created         28/Dec/1999
    57  * @author  Catalin Rotaru [CATA]
    58  */
    59 class nsExtensibleStringBundle : public nsIStringBundle
    60 {
    61   NS_DECL_ISUPPORTS
    62   NS_DECL_NSISTRINGBUNDLE
    64   nsresult Init(const char * aCategory, nsIStringBundleService *);
    65 private:
    67   nsCOMArray<nsIStringBundle> mBundles;
    68   bool               mLoaded;
    70 public:
    72   nsExtensibleStringBundle();
    73   virtual ~nsExtensibleStringBundle();
    74 };
    78 #endif

mercurial