tor-browser

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

CookiePrivateStorage.h (2014B)


      1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
      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/. */
      5 
      6 #ifndef mozilla_net_CookiePrivateStorage_h
      7 #define mozilla_net_CookiePrivateStorage_h
      8 
      9 #include "CookieStorage.h"
     10 
     11 class nsICookieTransactionCallback;
     12 
     13 namespace mozilla {
     14 namespace net {
     15 
     16 class CookiePrivateStorage final : public CookieStorage {
     17 public:
     18  static already_AddRefed<CookiePrivateStorage> Create();
     19 
     20  void StaleCookies(const nsTArray<RefPtr<Cookie>>& aCookieList,
     21                    int64_t aCurrentTimeInUsec) override;
     22 
     23  void Close() override {};
     24 
     25  void EnsureInitialized() override {};
     26 
     27  nsresult RunInTransaction(nsICookieTransactionCallback* aCallback) override {
     28    // It might make sense for this to be a no-op, or to return
     29    // `NS_ERROR_NOT_AVAILABLE`, or to evalute `aCallback` (in case it has
     30    // side-effects), but for now, just crash.
     31    MOZ_CRASH("RunInTransaction is not supported for private storage");
     32  };
     33 
     34 protected:
     35  const char* NotificationTopic() const override {
     36    return "private-cookie-changed";
     37  }
     38 
     39  void NotifyChangedInternal(nsICookieNotification* aNotification,
     40                             bool aOldCookieIsSession) override {}
     41 
     42  void RemoveAllInternal() override {}
     43 
     44  void RemoveCookieFromDB(const Cookie& aCookie) override {}
     45 
     46  already_AddRefed<nsIArray> PurgeCookies(int64_t aCurrentTimeInUsec,
     47                                          uint16_t aMaxNumberOfCookies,
     48                                          int64_t aCookiePurgeAge) override;
     49 
     50  void StoreCookie(const nsACString& aBaseDomain,
     51                   const OriginAttributes& aOriginAttributes,
     52                   Cookie* aCookie) override {}
     53 
     54 private:
     55  void CollectCookieJarSizeData() override {};
     56 };
     57 
     58 }  // namespace net
     59 }  // namespace mozilla
     60 
     61 #endif  // mozilla_net_CookiePrivateStorage_h