| // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| |
| #ifndef STORAGE_BROWSER_FILEAPI_FILE_SYSTEM_QUOTA_CLIENT_H_ |
| #define STORAGE_BROWSER_FILEAPI_FILE_SYSTEM_QUOTA_CLIENT_H_ |
| |
| #include <set> |
| #include <string> |
| #include <utility> |
| |
| #include "base/compiler_specific.h" |
| #include "base/component_export.h" |
| #include "base/files/file_path.h" |
| #include "base/macros.h" |
| #include "base/memory/ref_counted.h" |
| #include "storage/browser/fileapi/file_system_quota_util.h" |
| #include "storage/browser/quota/quota_client.h" |
| #include "storage/common/fileapi/file_system_types.h" |
| #include "third_party/blink/public/mojom/quota/quota_types.mojom.h" |
| #include "url/origin.h" |
| |
| namespace base { |
| class SequencedTaskRunner; |
| } |
| |
| namespace storage { |
| |
| class FileSystemContext; |
| |
| // An instance of this class is created per-profile. This class |
| // is self-destructed and will delete itself when OnQuotaManagerDestroyed |
| // is called. |
| // All of the public methods of this class are called by the quota manager |
| // (except for the constructor/destructor). |
| class COMPONENT_EXPORT(STORAGE_BROWSER) FileSystemQuotaClient |
| : public storage::QuotaClient { |
| public: |
| FileSystemQuotaClient( |
| FileSystemContext* file_system_context, |
| bool is_incognito); |
| ~FileSystemQuotaClient() override; |
| |
| // QuotaClient methods. |
| storage::QuotaClient::ID id() const override; |
| void OnQuotaManagerDestroyed() override; |
| void GetOriginUsage(const url::Origin& origin, |
| blink::mojom::StorageType type, |
| GetUsageCallback callback) override; |
| void GetOriginsForType(blink::mojom::StorageType type, |
| GetOriginsCallback callback) override; |
| void GetOriginsForHost(blink::mojom::StorageType type, |
| const std::string& host, |
| GetOriginsCallback callback) override; |
| void DeleteOriginData(const url::Origin& origin, |
| blink::mojom::StorageType type, |
| DeletionCallback callback) override; |
| void PerformStorageCleanup(blink::mojom::StorageType type, |
| base::OnceClosure callback) override; |
| bool DoesSupport(blink::mojom::StorageType type) const override; |
| |
| private: |
| base::SequencedTaskRunner* file_task_runner() const; |
| |
| scoped_refptr<FileSystemContext> file_system_context_; |
| |
| bool is_incognito_; |
| |
| DISALLOW_COPY_AND_ASSIGN(FileSystemQuotaClient); |
| }; |
| |
| } // namespace storage |
| |
| #endif // STORAGE_BROWSER_FILEAPI_FILE_SYSTEM_QUOTA_CLIENT_H_ |