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_FILEAPI_FILE_SYSTEM_QUOTA_CLIENT_H_ | 5 #ifndef WEBKIT_FILEAPI_FILE_SYSTEM_QUOTA_CLIENT_H_ |
6 #define WEBKIT_FILEAPI_FILE_SYSTEM_QUOTA_CLIENT_H_ | 6 #define WEBKIT_FILEAPI_FILE_SYSTEM_QUOTA_CLIENT_H_ |
7 | 7 |
8 #include <deque> | 8 #include <deque> |
9 #include <list> | 9 #include <list> |
10 #include <map> | 10 #include <map> |
(...skipping 25 matching lines...) Expand all Loading... |
36 scoped_refptr<base::MessageLoopProxy> file_message_loop, | 36 scoped_refptr<base::MessageLoopProxy> file_message_loop, |
37 FileSystemContext* file_system_context, | 37 FileSystemContext* file_system_context, |
38 bool is_incognito); | 38 bool is_incognito); |
39 virtual ~FileSystemQuotaClient(); | 39 virtual ~FileSystemQuotaClient(); |
40 | 40 |
41 // QuotaClient methods. | 41 // QuotaClient methods. |
42 virtual quota::QuotaClient::ID id() const OVERRIDE; | 42 virtual quota::QuotaClient::ID id() const OVERRIDE; |
43 virtual void OnQuotaManagerDestroyed() OVERRIDE; | 43 virtual void OnQuotaManagerDestroyed() OVERRIDE; |
44 virtual void GetOriginUsage(const GURL& origin_url, | 44 virtual void GetOriginUsage(const GURL& origin_url, |
45 quota::StorageType type, | 45 quota::StorageType type, |
46 GetUsageCallback* callback) OVERRIDE; | 46 const GetUsageCallback& callback) OVERRIDE; |
47 virtual void GetOriginsForType(quota::StorageType type, | 47 virtual void GetOriginsForType( |
48 GetOriginsCallback* callback) OVERRIDE; | 48 quota::StorageType type, |
49 virtual void GetOriginsForHost(quota::StorageType type, | 49 const GetOriginsCallback& callback) OVERRIDE; |
50 const std::string& host, | 50 virtual void GetOriginsForHost( |
51 GetOriginsCallback* callback) OVERRIDE; | 51 quota::StorageType type, |
52 virtual void DeleteOriginData(const GURL& origin, | 52 const std::string& host, |
53 quota::StorageType type, | 53 const GetOriginsCallback& callback) OVERRIDE; |
54 DeletionCallback* callback) OVERRIDE; | 54 virtual void DeleteOriginData( |
| 55 const GURL& origin, |
| 56 quota::StorageType type, |
| 57 const DeletionCallback& callback) OVERRIDE; |
55 | 58 |
56 private: | 59 private: |
57 class GetOriginUsageTask; | 60 class GetOriginUsageTask; |
58 class GetOriginsTaskBase; | 61 class GetOriginsTaskBase; |
59 class GetOriginsForTypeTask; | 62 class GetOriginsForTypeTask; |
60 class GetOriginsForHostTask; | 63 class GetOriginsForHostTask; |
61 class DeleteOriginTask; | 64 class DeleteOriginTask; |
62 | 65 |
63 typedef std::pair<fileapi::FileSystemType, std::string> TypeAndHostOrOrigin; | 66 typedef std::pair<fileapi::FileSystemType, std::string> TypeAndHostOrOrigin; |
64 typedef quota::CallbackQueueMap1<GetUsageCallback*, | 67 typedef quota::CallbackQueueMap1<GetUsageCallback, |
65 TypeAndHostOrOrigin, | 68 TypeAndHostOrOrigin, |
66 int64 | 69 int64 |
67 > UsageCallbackMap; | 70 > UsageCallbackMap; |
68 typedef quota::CallbackQueueMap2<GetOriginsCallback*, | 71 typedef quota::CallbackQueueMap2<GetOriginsCallback, |
69 fileapi::FileSystemType, | 72 fileapi::FileSystemType, |
70 const std::set<GURL>&, | 73 const std::set<GURL>&, |
71 quota::StorageType | 74 quota::StorageType |
72 > OriginsForTypeCallbackMap; | 75 > OriginsForTypeCallbackMap; |
73 typedef quota::CallbackQueueMap2<GetOriginsCallback*, | 76 typedef quota::CallbackQueueMap2<GetOriginsCallback, |
74 TypeAndHostOrOrigin, | 77 TypeAndHostOrOrigin, |
75 const std::set<GURL>&, | 78 const std::set<GURL>&, |
76 quota::StorageType | 79 quota::StorageType |
77 > OriginsForHostCallbackMap; | 80 > OriginsForHostCallbackMap; |
78 | 81 |
79 void DidGetOriginUsage(fileapi::FileSystemType type, | 82 void DidGetOriginUsage(fileapi::FileSystemType type, |
80 const GURL& origin, int64 usage); | 83 const GURL& origin, int64 usage); |
81 void DidGetOriginsForType(fileapi::FileSystemType type, | 84 void DidGetOriginsForType(fileapi::FileSystemType type, |
82 const std::set<GURL>& origins); | 85 const std::set<GURL>& origins); |
83 void DidGetOriginsForHost(const TypeAndHostOrOrigin& type_and_host, | 86 void DidGetOriginsForHost(const TypeAndHostOrOrigin& type_and_host, |
84 const std::set<GURL>& origins); | 87 const std::set<GURL>& origins); |
85 | 88 |
86 scoped_refptr<base::MessageLoopProxy> file_message_loop_; | 89 scoped_refptr<base::MessageLoopProxy> file_message_loop_; |
87 scoped_refptr<FileSystemContext> file_system_context_; | 90 scoped_refptr<FileSystemContext> file_system_context_; |
88 | 91 |
89 bool is_incognito_; | 92 bool is_incognito_; |
90 | 93 |
91 // Pending callbacks. | 94 // Pending callbacks. |
92 UsageCallbackMap pending_usage_callbacks_; | 95 UsageCallbackMap pending_usage_callbacks_; |
93 OriginsForTypeCallbackMap pending_origins_for_type_callbacks_; | 96 OriginsForTypeCallbackMap pending_origins_for_type_callbacks_; |
94 OriginsForHostCallbackMap pending_origins_for_host_callbacks_; | 97 OriginsForHostCallbackMap pending_origins_for_host_callbacks_; |
95 | 98 |
96 DISALLOW_COPY_AND_ASSIGN(FileSystemQuotaClient); | 99 DISALLOW_COPY_AND_ASSIGN(FileSystemQuotaClient); |
97 }; | 100 }; |
98 | 101 |
99 } // namespace fileapi | 102 } // namespace fileapi |
100 | 103 |
101 #endif // WEBKIT_FILEAPI_FILE_SYSTEM_QUOTA_CLIENT_H_ | 104 #endif // WEBKIT_FILEAPI_FILE_SYSTEM_QUOTA_CLIENT_H_ |
OLD | NEW |