OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CONTENT_BROWER_IN_PROCESS_WEBKIT_QUOTA_CLIENT_H_ |
| 6 #define CONTENT_BROWER_IN_PROCESS_WEBKIT_QUOTA_CLIENT_H_ |
| 7 |
| 8 #include <set> |
| 9 #include <string> |
| 10 |
| 11 #include "base/memory/ref_counted.h" |
| 12 #include "base/message_loop_proxy.h" |
| 13 #include "webkit/quota/quota_client.h" |
| 14 #include "webkit/quota/quota_task.h" |
| 15 #include "webkit/quota/quota_types.h" |
| 16 |
| 17 class IndexedDBContext; |
| 18 |
| 19 // A QuotaClient implementation to integrate IndexedDB |
| 20 // with the quota management system. This interface is used |
| 21 // on the IO thread by the quota manager. |
| 22 class IndexedDBQuotaClient : public quota::QuotaClient, |
| 23 public quota::QuotaTaskObserver { |
| 24 public: |
| 25 IndexedDBQuotaClient( |
| 26 base::MessageLoopProxy* tracker_thread, |
| 27 IndexedDBContext* indexed_db_context); |
| 28 virtual ~IndexedDBQuotaClient(); |
| 29 |
| 30 // QuotaClient method overrides |
| 31 virtual ID id() const OVERRIDE; |
| 32 virtual void OnQuotaManagerDestroyed() OVERRIDE; |
| 33 virtual void GetOriginUsage(const GURL& origin_url, |
| 34 quota::StorageType type, |
| 35 GetUsageCallback* callback) OVERRIDE; |
| 36 virtual void GetOriginsForType(quota::StorageType type, |
| 37 GetOriginsCallback* callback) OVERRIDE; |
| 38 virtual void GetOriginsForHost(quota::StorageType type, |
| 39 const std::string& host, |
| 40 GetOriginsCallback* callback) OVERRIDE; |
| 41 virtual void DeleteOriginData(const GURL& origin, |
| 42 quota::StorageType type, |
| 43 DeletionCallback* callback) OVERRIDE; |
| 44 private: |
| 45 class HelperTask; |
| 46 class GetOriginUsageTask; |
| 47 class GetOriginsTaskBase; |
| 48 class GetAllOriginsTask; |
| 49 class GetOriginsForHostTask; |
| 50 |
| 51 typedef quota::CallbackQueueMap1 |
| 52 <GetUsageCallback*, |
| 53 GURL, // origin |
| 54 int64 |
| 55 > UsageForOriginCallbackMap; |
| 56 typedef quota::CallbackQueue1 |
| 57 <GetOriginsCallback*, |
| 58 const std::set<GURL>& |
| 59 > OriginsForTypeCallbackQueue; |
| 60 typedef quota::CallbackQueueMap1 |
| 61 <GetOriginsCallback*, |
| 62 std::string, // host |
| 63 const std::set<GURL>& |
| 64 > OriginsForHostCallbackMap; |
| 65 |
| 66 void DidGetOriginUsage(const GURL& origin_url, int64 usage); |
| 67 void DidGetAllOrigins(const std::set<GURL>& origins); |
| 68 void DidGetOriginsForHost( |
| 69 const std::string& host, const std::set<GURL>& origins); |
| 70 |
| 71 scoped_refptr<base::MessageLoopProxy> webkit_thread_message_loop_; |
| 72 scoped_refptr<IndexedDBContext> indexed_db_context_; |
| 73 UsageForOriginCallbackMap usage_for_origin_callbacks_; |
| 74 OriginsForTypeCallbackQueue origins_for_type_callbacks_; |
| 75 OriginsForHostCallbackMap origins_for_host_callbacks_; |
| 76 |
| 77 DISALLOW_COPY_AND_ASSIGN(IndexedDBQuotaClient); |
| 78 }; |
| 79 |
| 80 #endif // CONTENT_BROWER_IN_PROCESS_WEBKIT_QUOTA_CLIENT_H_ |
OLD | NEW |