OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef WEBKIT_BROWSER_FILEAPI_FILE_SYSTEM_QUOTA_UTIL_H_ | 5 #ifndef WEBKIT_BROWSER_FILEAPI_FILE_SYSTEM_QUOTA_UTIL_H_ |
6 #define WEBKIT_BROWSER_FILEAPI_FILE_SYSTEM_QUOTA_UTIL_H_ | 6 #define WEBKIT_BROWSER_FILEAPI_FILE_SYSTEM_QUOTA_UTIL_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 #include "base/files/file.h" | 12 #include "base/files/file.h" |
13 #include "url/gurl.h" | 13 #include "url/gurl.h" |
14 #include "webkit/browser/fileapi/task_runner_bound_observer_list.h" | 14 #include "storage/browser/fileapi/task_runner_bound_observer_list.h" |
15 #include "webkit/browser/webkit_storage_browser_export.h" | 15 #include "storage/common/storage_export.h" |
16 #include "webkit/common/fileapi/file_system_types.h" | 16 #include "storage/common/fileapi/file_system_types.h" |
17 | 17 |
18 namespace base { | 18 namespace base { |
19 class SequencedTaskRunner; | 19 class SequencedTaskRunner; |
20 } | 20 } |
21 | 21 |
22 namespace quota { | 22 namespace quota { |
23 class QuotaManagerProxy; | 23 class QuotaManagerProxy; |
24 } | 24 } |
25 | 25 |
26 namespace fileapi { | 26 namespace storage { |
27 | 27 |
28 class FileSystemContext; | 28 class FileSystemContext; |
29 class QuotaReservation; | 29 class QuotaReservation; |
30 | 30 |
31 // An abstract interface that provides common quota-related utility functions | 31 // An abstract interface that provides common quota-related utility functions |
32 // for file_system_quota_client. | 32 // for file_system_quota_client. |
33 // All the methods of this class are synchronous and need to be called on | 33 // All the methods of this class are synchronous and need to be called on |
34 // the thread that the method name implies. | 34 // the thread that the method name implies. |
35 class WEBKIT_STORAGE_BROWSER_EXPORT FileSystemQuotaUtil { | 35 class STORAGE_EXPORT FileSystemQuotaUtil { |
36 public: | 36 public: |
37 virtual ~FileSystemQuotaUtil() {} | 37 virtual ~FileSystemQuotaUtil() {} |
38 | 38 |
39 // Deletes the data on the origin and reports the amount of deleted data | 39 // Deletes the data on the origin and reports the amount of deleted data |
40 // to the quota manager via |proxy|. | 40 // to the quota manager via |proxy|. |
41 virtual base::File::Error DeleteOriginDataOnFileTaskRunner( | 41 virtual base::File::Error DeleteOriginDataOnFileTaskRunner( |
42 FileSystemContext* context, | 42 FileSystemContext* context, |
43 quota::QuotaManagerProxy* proxy, | 43 quota::QuotaManagerProxy* proxy, |
44 const GURL& origin_url, | 44 const GURL& origin_url, |
45 FileSystemType type) = 0; | 45 FileSystemType type) = 0; |
46 | 46 |
47 virtual void GetOriginsForTypeOnFileTaskRunner( | 47 virtual void GetOriginsForTypeOnFileTaskRunner(storage::FileSystemType type, |
48 fileapi::FileSystemType type, | 48 std::set<GURL>* origins) = 0; |
49 std::set<GURL>* origins) = 0; | |
50 | 49 |
51 virtual void GetOriginsForHostOnFileTaskRunner( | 50 virtual void GetOriginsForHostOnFileTaskRunner(storage::FileSystemType type, |
52 fileapi::FileSystemType type, | 51 const std::string& host, |
53 const std::string& host, | 52 std::set<GURL>* origins) = 0; |
54 std::set<GURL>* origins) = 0; | |
55 | 53 |
56 // Returns the amount of data used for the origin for usage tracking. | 54 // Returns the amount of data used for the origin for usage tracking. |
57 virtual int64 GetOriginUsageOnFileTaskRunner( | 55 virtual int64 GetOriginUsageOnFileTaskRunner( |
58 fileapi::FileSystemContext* file_system_context, | 56 storage::FileSystemContext* file_system_context, |
59 const GURL& origin_url, | 57 const GURL& origin_url, |
60 fileapi::FileSystemType type) = 0; | 58 storage::FileSystemType type) = 0; |
61 | 59 |
62 // Creates new reservation object for the origin and the type. | 60 // Creates new reservation object for the origin and the type. |
63 virtual scoped_refptr<QuotaReservation> | 61 virtual scoped_refptr<QuotaReservation> |
64 CreateQuotaReservationOnFileTaskRunner( | 62 CreateQuotaReservationOnFileTaskRunner(const GURL& origin_url, |
65 const GURL& origin_url, | 63 FileSystemType type) = 0; |
66 FileSystemType type) = 0; | |
67 | 64 |
68 virtual void AddFileUpdateObserver( | 65 virtual void AddFileUpdateObserver( |
69 FileSystemType type, | 66 FileSystemType type, |
70 FileUpdateObserver* observer, | 67 FileUpdateObserver* observer, |
71 base::SequencedTaskRunner* task_runner) = 0; | 68 base::SequencedTaskRunner* task_runner) = 0; |
72 virtual void AddFileChangeObserver( | 69 virtual void AddFileChangeObserver( |
73 FileSystemType type, | 70 FileSystemType type, |
74 FileChangeObserver* observer, | 71 FileChangeObserver* observer, |
75 base::SequencedTaskRunner* task_runner) = 0; | 72 base::SequencedTaskRunner* task_runner) = 0; |
76 virtual void AddFileAccessObserver( | 73 virtual void AddFileAccessObserver( |
77 FileSystemType type, | 74 FileSystemType type, |
78 FileAccessObserver* observer, | 75 FileAccessObserver* observer, |
79 base::SequencedTaskRunner* task_runner) = 0; | 76 base::SequencedTaskRunner* task_runner) = 0; |
80 | 77 |
81 // Returns the observer list for |type|, or returns NULL if any observers | 78 // Returns the observer list for |type|, or returns NULL if any observers |
82 // have not been registered on |type|. | 79 // have not been registered on |type|. |
83 virtual const UpdateObserverList* GetUpdateObservers( | 80 virtual const UpdateObserverList* GetUpdateObservers( |
84 FileSystemType type) const = 0; | 81 FileSystemType type) const = 0; |
85 virtual const ChangeObserverList* GetChangeObservers( | 82 virtual const ChangeObserverList* GetChangeObservers( |
86 FileSystemType type) const = 0; | 83 FileSystemType type) const = 0; |
87 virtual const AccessObserverList* GetAccessObservers( | 84 virtual const AccessObserverList* GetAccessObservers( |
88 FileSystemType type) const = 0; | 85 FileSystemType type) const = 0; |
89 }; | 86 }; |
90 | 87 |
91 } // namespace fileapi | 88 } // namespace storage |
92 | 89 |
93 #endif // WEBKIT_BROWSER_FILEAPI_FILE_SYSTEM_QUOTA_UTIL_H_ | 90 #endif // WEBKIT_BROWSER_FILEAPI_FILE_SYSTEM_QUOTA_UTIL_H_ |
OLD | NEW |