1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef STORAGE_BROWSER_FILEAPI_FILE_SYSTEM_QUOTA_UTIL_H_
6 #define STORAGE_BROWSER_FILEAPI_FILE_SYSTEM_QUOTA_UTIL_H_
11 #include "base/basictypes.h"
12 #include "base/files/file.h"
13 #include "storage/browser/storage_browser_export.h"
14 #include "storage/common/fileapi/file_system_types.h"
18 class SequencedTaskRunner
;
22 class QuotaManagerProxy
;
27 class FileSystemContext
;
28 class QuotaReservation
;
30 // An abstract interface that provides common quota-related utility functions
31 // for file_system_quota_client.
32 // All the methods of this class are synchronous and need to be called on
33 // the thread that the method name implies.
34 class STORAGE_EXPORT FileSystemQuotaUtil
{
36 virtual ~FileSystemQuotaUtil() {}
38 // Deletes the data on the origin and reports the amount of deleted data
39 // to the quota manager via |proxy|.
40 virtual base::File::Error
DeleteOriginDataOnFileTaskRunner(
41 FileSystemContext
* context
,
42 storage::QuotaManagerProxy
* proxy
,
43 const GURL
& origin_url
,
44 FileSystemType type
) = 0;
46 virtual void GetOriginsForTypeOnFileTaskRunner(storage::FileSystemType type
,
47 std::set
<GURL
>* origins
) = 0;
49 virtual void GetOriginsForHostOnFileTaskRunner(storage::FileSystemType type
,
50 const std::string
& host
,
51 std::set
<GURL
>* origins
) = 0;
53 // Returns the amount of data used for the origin for usage tracking.
54 virtual int64
GetOriginUsageOnFileTaskRunner(
55 storage::FileSystemContext
* file_system_context
,
56 const GURL
& origin_url
,
57 storage::FileSystemType type
) = 0;
59 // Creates new reservation object for the origin and the type.
60 virtual scoped_refptr
<QuotaReservation
>
61 CreateQuotaReservationOnFileTaskRunner(
62 const GURL
& origin_url
,
63 FileSystemType type
) = 0;
66 } // namespace storage
68 #endif // STORAGE_BROWSER_FILEAPI_FILE_SYSTEM_QUOTA_UTIL_H_