blob: e4e46432063f8774bb56e372355587a590b78eee [file] [log] [blame]
// 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_FILE_SYSTEM_FILE_SYSTEM_QUOTA_CLIENT_H_
#define STORAGE_BROWSER_FILE_SYSTEM_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/file_system/file_system_quota_util.h"
#include "storage/browser/quota/quota_client.h"
#include "storage/common/file_system/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;
// 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 QuotaClient {
public:
FileSystemQuotaClient(FileSystemContext* file_system_context);
// QuotaClient methods.
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:
~FileSystemQuotaClient() override;
base::SequencedTaskRunner* file_task_runner() const;
scoped_refptr<FileSystemContext> file_system_context_;
DISALLOW_COPY_AND_ASSIGN(FileSystemQuotaClient);
};
} // namespace storage
#endif // STORAGE_BROWSER_FILE_SYSTEM_FILE_SYSTEM_QUOTA_CLIENT_H_