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 <list> |
9 #include <set> | 9 #include <set> |
10 #include <string> | 10 #include <string> |
(...skipping 12 matching lines...) Expand all Loading... | |
23 class QuotaClient { | 23 class QuotaClient { |
24 public: | 24 public: |
25 typedef Callback1<int64>::Type GetUsageCallback; | 25 typedef Callback1<int64>::Type GetUsageCallback; |
26 typedef Callback2<const std::set<GURL>&, StorageType>::Type | 26 typedef Callback2<const std::set<GURL>&, StorageType>::Type |
27 GetOriginsCallback; | 27 GetOriginsCallback; |
28 typedef Callback1<QuotaStatusCode>::Type DeletionCallback; | 28 typedef Callback1<QuotaStatusCode>::Type DeletionCallback; |
29 | 29 |
30 virtual ~QuotaClient() {} | 30 virtual ~QuotaClient() {} |
31 | 31 |
32 enum ID { | 32 enum ID { |
33 kUnknown, | 33 kUnknown = 1 << 0, |
34 kFileSystem, | 34 kFileSystem = 1 << 1, |
35 kDatabase, | 35 kDatabase = 1 << 2, |
36 kAppcache, | 36 kAppcache = 1 << 3, |
37 kIndexedDatabase, | 37 kIndexedDatabase = 1 << 4, |
38 kMockStart, // This needs to be the end of the enum. | 38 kMockStart, // This needs to be the end of the enum. |
kinuko
2011/09/26 09:43:48
what should we do if we want to test the feature w
| |
39 }; | 39 }; |
40 | 40 |
41 static const int kAllClientsMask = kFileSystem | kDatabase | kAppcache | | |
42 kIndexedDatabase; | |
kinuko
2011/09/26 09:43:48
-1?
| |
43 | |
41 virtual ID id() const = 0; | 44 virtual ID id() const = 0; |
42 | 45 |
43 // Called when the quota manager is destroyed. | 46 // Called when the quota manager is destroyed. |
44 virtual void OnQuotaManagerDestroyed() = 0; | 47 virtual void OnQuotaManagerDestroyed() = 0; |
45 | 48 |
46 // Called by the QuotaManager. | 49 // Called by the QuotaManager. |
47 // Gets the amount of data stored in the storage specified by | 50 // Gets the amount of data stored in the storage specified by |
48 // |origin_url| and |type|. | 51 // |origin_url| and |type|. |
49 virtual void GetOriginUsage(const GURL& origin_url, | 52 virtual void GetOriginUsage(const GURL& origin_url, |
50 StorageType type, | 53 StorageType type, |
51 GetUsageCallback* callback) = 0; | 54 GetUsageCallback* callback) = 0; |
52 | 55 |
53 // Called by the QuotaManager. | 56 // Called by the QuotaManager. |
54 // Returns a list of origins that has data in the |type| storage. | 57 // Returns a list of origins that has data in the |type| storage. |
55 virtual void GetOriginsForType(StorageType type, | 58 virtual void GetOriginsForType(StorageType type, |
56 GetOriginsCallback* callback) = 0; | 59 GetOriginsCallback* callback) = 0; |
57 | 60 |
58 // Called by the QuotaManager. | 61 // Called by the QuotaManager. |
59 // Returns a list of origins that match the |host|. | 62 // Returns a list of origins that match the |host|. |
60 virtual void GetOriginsForHost(StorageType type, | 63 virtual void GetOriginsForHost(StorageType type, |
61 const std::string& host, | 64 const std::string& host, |
62 GetOriginsCallback* callback) = 0; | 65 GetOriginsCallback* callback) = 0; |
63 | 66 |
64 // Called by the QuotaManager. | 67 // Called by the QuotaManager. |
65 virtual void DeleteOriginData(const GURL& origin, | 68 virtual void DeleteOriginData(const GURL& origin, |
66 StorageType type, | 69 StorageType type, |
67 DeletionCallback* callback) = 0; | 70 DeletionCallback* callback) = 0; |
68 }; | 71 }; |
69 | 72 |
73 const int kQuotaClientAllIDsMask = QuotaClient::kFileSystem | | |
74 QuotaClient::kDatabase | QuotaClient::kAppcache | | |
75 QuotaClient::kIndexedDatabase; | |
kinuko
2011/09/26 09:43:48
is this a dupe of line 41?
| |
76 | |
70 // TODO(dmikurube): Replace it to std::vector for efficiency. | 77 // TODO(dmikurube): Replace it to std::vector for efficiency. |
71 typedef std::list<QuotaClient*> QuotaClientList; | 78 typedef std::list<QuotaClient*> QuotaClientList; |
72 | 79 |
73 } // namespace quota | 80 } // namespace quota |
74 | 81 |
75 #endif // WEBKIT_QUOTA_QUOTA_CLIENT_H_ | 82 #endif // WEBKIT_QUOTA_QUOTA_CLIENT_H_ |
OLD | NEW |