OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_QUOTA_QUOTA_CLIENT_H_ | 5 #ifndef WEBKIT_QUOTA_QUOTA_CLIENT_H_ |
6 #define WEBKIT_QUOTA_QUOTA_CLIENT_H_ | 6 #define WEBKIT_QUOTA_QUOTA_CLIENT_H_ |
7 | 7 |
| 8 #include <list> |
8 #include <set> | 9 #include <set> |
9 #include <list> | 10 #include <string> |
10 | 11 |
11 #include "base/callback_old.h" | 12 #include "base/callback_old.h" |
12 #include "base/time.h" | 13 #include "base/time.h" |
13 #include "googleurl/src/gurl.h" | 14 #include "googleurl/src/gurl.h" |
14 #include "webkit/quota/quota_types.h" | 15 #include "webkit/quota/quota_types.h" |
15 | 16 |
16 namespace quota { | 17 namespace quota { |
17 | 18 |
18 // An abstract interface for quota manager clients. | 19 // An abstract interface for quota manager clients. |
19 // Each storage API must provide an implementation of this interface and | 20 // Each storage API must provide an implementation of this interface and |
20 // register it to the quota manager. | 21 // register it to the quota manager. |
21 // All the methods are assumed to be called on the IO thread in the browser. | 22 // All the methods are assumed to be called on the IO thread in the browser. |
22 class QuotaClient { | 23 class QuotaClient { |
23 public: | 24 public: |
24 typedef Callback1<int64>::Type GetUsageCallback; | 25 typedef Callback1<int64>::Type GetUsageCallback; |
25 typedef Callback1<const std::set<GURL>&>::Type GetOriginsCallback; | 26 typedef Callback1<const std::set<GURL>&>::Type GetOriginsCallback; |
| 27 typedef Callback1<QuotaStatusCode>::Type DeletionCallback; |
26 | 28 |
27 virtual ~QuotaClient() {} | 29 virtual ~QuotaClient() {} |
28 | 30 |
29 enum ID { | 31 enum ID { |
30 kUnknown, | 32 kUnknown, |
31 kFileSystem, | 33 kFileSystem, |
32 kDatabase, | 34 kDatabase, |
33 kAppcache, | 35 kAppcache, |
34 kIndexedDatabase, | 36 kIndexedDatabase, |
35 kMockStart, // This needs to be the end of the enum. | 37 kMockStart, // This needs to be the end of the enum. |
(...skipping 14 matching lines...) Expand all Loading... |
50 // Called by the QuotaManager. | 52 // Called by the QuotaManager. |
51 // Returns a list of origins that has data in the |type| storage. | 53 // Returns a list of origins that has data in the |type| storage. |
52 virtual void GetOriginsForType(StorageType type, | 54 virtual void GetOriginsForType(StorageType type, |
53 GetOriginsCallback* callback) = 0; | 55 GetOriginsCallback* callback) = 0; |
54 | 56 |
55 // Called by the QuotaManager. | 57 // Called by the QuotaManager. |
56 // Returns a list of origins that match the |host|. | 58 // Returns a list of origins that match the |host|. |
57 virtual void GetOriginsForHost(StorageType type, | 59 virtual void GetOriginsForHost(StorageType type, |
58 const std::string& host, | 60 const std::string& host, |
59 GetOriginsCallback* callback) = 0; | 61 GetOriginsCallback* callback) = 0; |
| 62 |
| 63 // Called by the QuotaManager. |
| 64 virtual void DeleteOriginData(const GURL& origin, |
| 65 StorageType type, |
| 66 DeletionCallback* callback) = 0; |
60 }; | 67 }; |
61 | 68 |
62 typedef std::list<QuotaClient*> QuotaClientList; | 69 typedef std::list<QuotaClient*> QuotaClientList; |
63 | 70 |
64 } // namespace quota | 71 } // namespace quota |
65 | 72 |
66 #endif // WEBKIT_QUOTA_QUOTA_CLIENT_H_ | 73 #endif // WEBKIT_QUOTA_QUOTA_CLIENT_H_ |
OLD | NEW |