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_TYPES_H_ | 5 #ifndef WEBKIT_QUOTA_QUOTA_TYPES_H_ |
6 #define WEBKIT_QUOTA_QUOTA_TYPES_H_ | 6 #define WEBKIT_QUOTA_QUOTA_TYPES_H_ |
7 | 7 |
8 #include <deque> | 8 #include <deque> |
9 #include <map> | 9 #include <map> |
10 #include <set> | 10 #include <set> |
11 #include <string> | 11 #include <string> |
12 #include <vector> | 12 #include <vector> |
13 | 13 |
14 #include "base/basictypes.h" | 14 #include "base/basictypes.h" |
15 #include "base/callback.h" | 15 #include "base/callback.h" |
| 16 #include "webkit/quota/quota_status_code.h" |
16 | 17 |
17 class GURL; | 18 class GURL; |
18 | 19 |
19 namespace quota { | 20 namespace quota { |
20 | 21 |
21 enum StorageType { | 22 enum StorageType { |
22 kStorageTypeTemporary, | 23 kStorageTypeTemporary, |
23 kStorageTypePersistent, | 24 kStorageTypePersistent, |
24 kStorageTypeSyncable, | 25 kStorageTypeSyncable, |
25 kStorageTypeUnknown, | 26 kStorageTypeUnknown, |
26 }; | 27 }; |
27 | 28 |
28 // The numbers should match with the error code defined in | |
29 // third_party/WebKit/Source/WebCore/dom/ExceptionCode.h. | |
30 enum QuotaStatusCode { | |
31 kQuotaStatusOk = 0, | |
32 kQuotaErrorNotSupported = 9, // NOT_SUPPORTED_ERR | |
33 kQuotaErrorInvalidModification = 13, // INVALID_MODIFICATION_ERR | |
34 kQuotaErrorInvalidAccess = 15, // INVALID_ACCESS_ERR | |
35 kQuotaErrorAbort = 20, // ABORT_ERR | |
36 kQuotaStatusUnknown = -1, | |
37 }; | |
38 | |
39 struct UsageInfo; | 29 struct UsageInfo; |
40 typedef std::vector<UsageInfo> UsageInfoEntries; | 30 typedef std::vector<UsageInfo> UsageInfoEntries; |
41 | 31 |
42 // Common callback types that are used throughout in the quota module. | 32 // Common callback types that are used throughout in the quota module. |
43 typedef base::Callback<void(StorageType status, | 33 typedef base::Callback<void(StorageType status, |
44 int64 usage, | 34 int64 usage, |
45 int64 unlimited_usage)> GlobalUsageCallback; | 35 int64 unlimited_usage)> GlobalUsageCallback; |
46 typedef base::Callback<void(QuotaStatusCode status, int64 quota)> QuotaCallback; | 36 typedef base::Callback<void(QuotaStatusCode status, int64 quota)> QuotaCallback; |
47 typedef base::Callback<void(int64 usage)> UsageCallback; | 37 typedef base::Callback<void(int64 usage)> UsageCallback; |
48 typedef base::Callback<void(QuotaStatusCode, int64)> AvailableSpaceCallback; | 38 typedef base::Callback<void(QuotaStatusCode, int64)> AvailableSpaceCallback; |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 this->callback_map_.erase(key); | 159 this->callback_map_.erase(key); |
170 } | 160 } |
171 }; | 161 }; |
172 | 162 |
173 typedef CallbackQueueMap1<UsageCallback, std::string, int64> | 163 typedef CallbackQueueMap1<UsageCallback, std::string, int64> |
174 HostUsageCallbackMap; | 164 HostUsageCallbackMap; |
175 | 165 |
176 } // namespace quota | 166 } // namespace quota |
177 | 167 |
178 #endif // WEBKIT_QUOTA_QUOTA_TYPES_H_ | 168 #endif // WEBKIT_QUOTA_QUOTA_TYPES_H_ |
OLD | NEW |