tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

UrlClassifierExceptionListEntry.h (1719B)


      1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
      2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
      3 /* This Source Code Form is subject to the terms of the Mozilla Public
      4 * License, v. 2.0. If a copy of the MPL was not distributed with this
      5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
      6 
      7 #ifndef mozilla_UrlClassifierExceptionListEntry_h
      8 #define mozilla_UrlClassifierExceptionListEntry_h
      9 
     10 #include "mozilla/extensions/MatchPattern.h"
     11 #include "nsIUrlClassifierExceptionListEntry.h"
     12 #include "nsString.h"
     13 #include "nsISupports.h"
     14 
     15 namespace mozilla::net {
     16 
     17 /**
     18 * @see nsIUrlClassifierExceptionListEntry
     19 */
     20 class UrlClassifierExceptionListEntry final
     21    : public nsIUrlClassifierExceptionListEntry {
     22 public:
     23  NS_DECL_ISUPPORTS
     24  NS_DECL_NSIURLCLASSIFIEREXCEPTIONLISTENTRY
     25 
     26  UrlClassifierExceptionListEntry() = default;
     27 
     28  UrlClassifierExceptionListEntry(
     29      const nsACString& aUrlPattern, const nsACString& aTopLevelUrlPattern,
     30      bool aIsPrivateBrowsingOnly,
     31      const nsTArray<nsCString>& aClassifierFeatures)
     32      : mUrlPattern(aUrlPattern),
     33        mTopLevelUrlPattern(aTopLevelUrlPattern),
     34        mIsPrivateBrowsingOnly(aIsPrivateBrowsingOnly) {
     35    mClassifierFeatures = aClassifierFeatures.Clone();
     36  }
     37 
     38 private:
     39  ~UrlClassifierExceptionListEntry() = default;
     40 
     41  nsIUrlClassifierExceptionListEntry::Category mCategory;
     42  nsCString mUrlPattern;
     43  nsCString mTopLevelUrlPattern;
     44  bool mIsPrivateBrowsingOnly{};
     45  nsTArray<nsCString> mFilterContentBlockingCategories;
     46  nsTArray<nsCString> mClassifierFeatures;
     47 
     48  RefPtr<extensions::MatchPatternCore> mMatcher;
     49  RefPtr<extensions::MatchPatternCore> mTopLevelMatcher;
     50 };
     51 
     52 }  // namespace mozilla::net
     53 
     54 #endif