intl/unicharutil/src/nsEntityConverter.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 nsEntityConverter_h__
     7 #define nsEntityConverter_h__
     9 #include "nsIEntityConverter.h"
    10 #include "nsIStringBundle.h"
    11 #include "nsCOMPtr.h"
    13 #define kVERSION_STRING_LEN 128
    15 class nsEntityVersionList
    16 {
    17 public:
    18     nsEntityVersionList() {}
    20     uint32_t mVersion;
    21     char16_t mEntityListName[kVERSION_STRING_LEN+1];
    22     nsCOMPtr<nsIStringBundle> mEntities;
    23 };
    25 class nsEntityConverter: public nsIEntityConverter
    26 {
    27 public:
    29 	//
    30 	// implementation methods
    31 	//
    32 	nsEntityConverter();
    33 	virtual ~nsEntityConverter();
    35 	//
    36 	// nsISupports
    37 	//
    38 	NS_DECL_ISUPPORTS
    40 	//
    41 	// nsIEntityConverter
    42 	//
    43 	NS_IMETHOD ConvertUTF32ToEntity(uint32_t character, uint32_t entityVersion, char **_retval);
    44 	NS_IMETHOD ConvertToEntity(char16_t character, uint32_t entityVersion, char **_retval);
    46 	NS_IMETHOD ConvertToEntities(const char16_t *inString, uint32_t entityVersion, char16_t **_retval);
    48 protected:
    50   // load a version property file and generate a version list (number/name pair)
    51   NS_IMETHOD LoadVersionPropertyFile();
    53   // map version number to version string
    54   const char16_t* GetVersionName(uint32_t versionNumber);
    56   // map version number to a string bundle
    57   nsIStringBundle* GetVersionBundleInstance(uint32_t versionNumber);
    59   // load a string bundle file
    60   already_AddRefed<nsIStringBundle> LoadEntityBundle(uint32_t version);
    63   nsEntityVersionList *mVersionList;            // array of version number/name pairs
    64   uint32_t mVersionListLength;                  // number of supported versions
    65 };
    67 #endif

mercurial