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> |
11 | 11 |
12 #include "base/callback_old.h" | 12 #include "base/callback.h" |
13 #include "base/time.h" | 13 #include "base/time.h" |
14 #include "googleurl/src/gurl.h" | 14 #include "googleurl/src/gurl.h" |
15 #include "webkit/quota/quota_types.h" | 15 #include "webkit/quota/quota_types.h" |
16 | 16 |
17 namespace quota { | 17 namespace quota { |
18 | 18 |
19 // An abstract interface for quota manager clients. | 19 // An abstract interface for quota manager clients. |
20 // Each storage API must provide an implementation of this interface and | 20 // Each storage API must provide an implementation of this interface and |
21 // register it to the quota manager. | 21 // register it to the quota manager. |
22 // 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. |
23 class QuotaClient { | 23 class QuotaClient { |
24 public: | 24 public: |
25 typedef Callback1<int64>::Type GetUsageCallback; | 25 typedef base::Callback<void (int64)> GetUsageCallback; // NOLINT |
awong
2011/09/29 18:05:15
prevailing style seems to not insert a space betwe
tzik
2011/10/11 04:53:57
Done.
| |
26 typedef Callback2<const std::set<GURL>&, StorageType>::Type | 26 typedef base::Callback<void (const std::set<GURL>&, StorageType)> |
27 GetOriginsCallback; | 27 GetOriginsCallback; |
28 typedef Callback1<QuotaStatusCode>::Type DeletionCallback; | 28 typedef base::Callback<void (QuotaStatusCode)> DeletionCallback; |
29 | 29 |
30 virtual ~QuotaClient() {} | 30 virtual ~QuotaClient() {} |
31 | 31 |
32 enum ID { | 32 enum ID { |
33 kUnknown, | 33 kUnknown, |
34 kFileSystem, | 34 kFileSystem, |
35 kDatabase, | 35 kDatabase, |
36 kAppcache, | 36 kAppcache, |
37 kIndexedDatabase, | 37 kIndexedDatabase, |
38 kMockStart, // This needs to be the end of the enum. | 38 kMockStart, // This needs to be the end of the enum. |
39 }; | 39 }; |
40 | 40 |
41 virtual ID id() const = 0; | 41 virtual ID id() const = 0; |
42 | 42 |
43 // Called when the quota manager is destroyed. | 43 // Called when the quota manager is destroyed. |
44 virtual void OnQuotaManagerDestroyed() = 0; | 44 virtual void OnQuotaManagerDestroyed() = 0; |
45 | 45 |
46 // Called by the QuotaManager. | 46 // Called by the QuotaManager. |
47 // Gets the amount of data stored in the storage specified by | 47 // Gets the amount of data stored in the storage specified by |
48 // |origin_url| and |type|. | 48 // |origin_url| and |type|. |
49 virtual void GetOriginUsage(const GURL& origin_url, | 49 virtual void GetOriginUsage(const GURL& origin_url, |
50 StorageType type, | 50 StorageType type, |
51 GetUsageCallback* callback) = 0; | 51 GetUsageCallback callback) = 0; |
awong
2011/09/29 18:05:15
const &.
tzik
2011/10/11 04:53:57
Done.
| |
52 | 52 |
53 // Called by the QuotaManager. | 53 // Called by the QuotaManager. |
54 // Returns a list of origins that has data in the |type| storage. | 54 // Returns a list of origins that has data in the |type| storage. |
55 virtual void GetOriginsForType(StorageType type, | 55 virtual void GetOriginsForType(StorageType type, |
56 GetOriginsCallback* callback) = 0; | 56 GetOriginsCallback callback) = 0; |
awong
2011/09/29 18:05:15
const &.
tzik
2011/10/11 04:53:57
Done.
| |
57 | 57 |
58 // Called by the QuotaManager. | 58 // Called by the QuotaManager. |
59 // Returns a list of origins that match the |host|. | 59 // Returns a list of origins that match the |host|. |
60 virtual void GetOriginsForHost(StorageType type, | 60 virtual void GetOriginsForHost(StorageType type, |
61 const std::string& host, | 61 const std::string& host, |
62 GetOriginsCallback* callback) = 0; | 62 GetOriginsCallback callback) = 0; |
awong
2011/09/29 18:05:15
const &.
tzik
2011/10/11 04:53:57
Done.
| |
63 | 63 |
64 // Called by the QuotaManager. | 64 // Called by the QuotaManager. |
65 virtual void DeleteOriginData(const GURL& origin, | 65 virtual void DeleteOriginData(const GURL& origin, |
66 StorageType type, | 66 StorageType type, |
67 DeletionCallback* callback) = 0; | 67 DeletionCallback callback) = 0; |
awong
2011/09/29 18:05:15
const &.
tzik
2011/10/11 04:53:57
Done.
| |
68 }; | 68 }; |
69 | 69 |
70 // TODO(dmikurube): Replace it to std::vector for efficiency. | 70 // TODO(dmikurube): Replace it to std::vector for efficiency. |
71 typedef std::list<QuotaClient*> QuotaClientList; | 71 typedef std::list<QuotaClient*> QuotaClientList; |
72 | 72 |
73 } // namespace quota | 73 } // namespace quota |
74 | 74 |
75 #endif // WEBKIT_QUOTA_QUOTA_CLIENT_H_ | 75 #endif // WEBKIT_QUOTA_QUOTA_CLIENT_H_ |
OLD | NEW |