tor-browser

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

StorageManager.h (1737B)


      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_dom_StorageManager_h
      8 #define mozilla_dom_StorageManager_h
      9 
     10 #include "js/TypeDecls.h"
     11 #include "mozilla/AlreadyAddRefed.h"
     12 #include "nsCOMPtr.h"
     13 #include "nsCycleCollectionParticipant.h"
     14 #include "nsISupports.h"
     15 #include "nsWrapperCache.h"
     16 
     17 class JSObject;
     18 class nsIGlobalObject;
     19 struct JSContext;
     20 
     21 namespace mozilla {
     22 class ErrorResult;
     23 
     24 namespace dom {
     25 
     26 class FileSystemManager;
     27 class Promise;
     28 struct StorageEstimate;
     29 
     30 class StorageManager final : public nsISupports, public nsWrapperCache {
     31  nsCOMPtr<nsIGlobalObject> mOwner;
     32 
     33 public:
     34  explicit StorageManager(nsIGlobalObject* aGlobal);
     35 
     36  NS_DECL_CYCLE_COLLECTING_ISUPPORTS
     37  NS_DECL_CYCLE_COLLECTION_WRAPPERCACHE_CLASS(StorageManager)
     38 
     39  void Shutdown();
     40 
     41  already_AddRefed<FileSystemManager> GetFileSystemManager();
     42 
     43  // WebIDL Boilerplate
     44  nsIGlobalObject* GetParentObject() const { return mOwner; }
     45 
     46  JSObject* WrapObject(JSContext* aCx,
     47                       JS::Handle<JSObject*> aGivenProto) override;
     48 
     49  // WebIDL Interface
     50  already_AddRefed<Promise> Persisted(ErrorResult& aRv);
     51 
     52  already_AddRefed<Promise> Persist(ErrorResult& aRv);
     53 
     54  already_AddRefed<Promise> Estimate(ErrorResult& aRv);
     55 
     56  already_AddRefed<Promise> GetDirectory(ErrorResult& aRv);
     57 
     58 private:
     59  ~StorageManager();
     60 
     61  RefPtr<FileSystemManager> mFileSystemManager;
     62 };
     63 
     64 }  // namespace dom
     65 }  // namespace mozilla
     66 
     67 #endif  // mozilla_dom_StorageManager_h