toolkit/components/autocomplete/nsAutoCompleteSimpleResult.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 /* This Source Code Form is subject to the terms of the Mozilla Public
     2  * License, v. 2.0. If a copy of the MPL was not distributed with this
     3  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     5 #ifndef __nsAutoCompleteSimpleResult__
     6 #define __nsAutoCompleteSimpleResult__
     8 #include "nsIAutoCompleteResult.h"
     9 #include "nsIAutoCompleteSimpleResult.h"
    11 #include "nsString.h"
    12 #include "nsCOMPtr.h"
    13 #include "nsTArray.h"
    14 #include "mozilla/Attributes.h"
    16 class nsAutoCompleteSimpleResult MOZ_FINAL : public nsIAutoCompleteSimpleResult
    17 {
    18 public:
    19   nsAutoCompleteSimpleResult();
    20   inline void CheckInvariants() {
    21     NS_ASSERTION(mValues.Length() == mComments.Length(), "Arrays out of sync");
    22     NS_ASSERTION(mValues.Length() == mImages.Length(),   "Arrays out of sync");
    23     NS_ASSERTION(mValues.Length() == mStyles.Length(),   "Arrays out of sync");
    24     NS_ASSERTION(mValues.Length() == mFinalCompleteValues.Length(), "Arrays out of sync");
    25   }
    27   NS_DECL_ISUPPORTS
    28   NS_DECL_NSIAUTOCOMPLETERESULT
    29   NS_DECL_NSIAUTOCOMPLETESIMPLERESULT
    31 private:
    32   ~nsAutoCompleteSimpleResult() {}
    34 protected:
    36   // What we really want is an array of structs with value/comment/image/style contents.
    37   // But then we'd either have to use COM or manage object lifetimes ourselves.
    38   // Having four arrays of string simplifies this, but is stupid.
    39   nsTArray<nsString> mValues;
    40   nsTArray<nsString> mComments;
    41   nsTArray<nsString> mImages;
    42   nsTArray<nsString> mStyles;
    43   nsTArray<nsString> mFinalCompleteValues;
    45   nsString mSearchString;
    46   nsString mErrorDescription;
    47   int32_t mDefaultIndex;
    48   uint32_t mSearchResult;
    50   bool mTypeAheadResult;
    52   nsCOMPtr<nsIAutoCompleteSimpleResultListener> mListener;
    53 };
    55 #endif // __nsAutoCompleteSimpleResult__

mercurial