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