OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 16 matching lines...) Expand all Loading... |
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
29 */ | 29 */ |
30 | 30 |
31 #include "config.h" | 31 #include "config.h" |
32 #include "modules/quota/StorageQuota.h" | 32 #include "modules/quota/StorageQuota.h" |
33 | 33 |
34 #include "core/dom/ExceptionCode.h" | 34 #include "core/dom/ExceptionCode.h" |
35 #include "core/dom/ExecutionContext.h" | 35 #include "core/dom/ExecutionContext.h" |
36 #include "modules/quota/StorageErrorCallback.h" | 36 #include "modules/quota/StorageErrorCallback.h" |
| 37 #include "modules/quota/StorageQuotaClient.h" |
37 #include "modules/quota/StorageUsageCallback.h" | 38 #include "modules/quota/StorageUsageCallback.h" |
38 #include "modules/quota/WebStorageQuotaCallbacksImpl.h" | 39 #include "modules/quota/WebStorageQuotaCallbacksImpl.h" |
39 #include "platform/weborigin/KURL.h" | 40 #include "platform/weborigin/KURL.h" |
40 #include "platform/weborigin/SecurityOrigin.h" | 41 #include "platform/weborigin/SecurityOrigin.h" |
41 #include "public/platform/Platform.h" | 42 #include "public/platform/Platform.h" |
42 #include "public/platform/WebStorageQuotaCallbacks.h" | 43 #include "public/platform/WebStorageQuotaCallbacks.h" |
43 #include "public/platform/WebStorageQuotaType.h" | 44 #include "public/platform/WebStorageQuotaType.h" |
44 | 45 |
45 namespace WebCore { | 46 namespace WebCore { |
46 | 47 |
(...skipping 17 matching lines...) Expand all Loading... |
64 SecurityOrigin* securityOrigin = executionContext->securityOrigin(); | 65 SecurityOrigin* securityOrigin = executionContext->securityOrigin(); |
65 if (securityOrigin->isUnique()) { | 66 if (securityOrigin->isUnique()) { |
66 executionContext->postTask(StorageErrorCallback::CallbackTask::create(er
rorCallback, NotSupportedError)); | 67 executionContext->postTask(StorageErrorCallback::CallbackTask::create(er
rorCallback, NotSupportedError)); |
67 return; | 68 return; |
68 } | 69 } |
69 | 70 |
70 KURL storagePartition = KURL(KURL(), securityOrigin->toString()); | 71 KURL storagePartition = KURL(KURL(), securityOrigin->toString()); |
71 blink::Platform::current()->queryStorageUsageAndQuota(storagePartition, stor
ageType, WebStorageQuotaCallbacksImpl::createLeakedPtr(successCallback, errorCal
lback)); | 72 blink::Platform::current()->queryStorageUsageAndQuota(storagePartition, stor
ageType, WebStorageQuotaCallbacksImpl::createLeakedPtr(successCallback, errorCal
lback)); |
72 } | 73 } |
73 | 74 |
| 75 void StorageQuota::requestQuota(ExecutionContext* executionContext, unsigned lon
g long newQuotaInBytes, PassOwnPtr<StorageQuotaCallback> successCallback, PassOw
nPtr<StorageErrorCallback> errorCallback) |
| 76 { |
| 77 ASSERT(executionContext); |
| 78 |
| 79 blink::WebStorageQuotaType storageType = static_cast<blink::WebStorageQuotaT
ype>(m_type); |
| 80 if (storageType != blink::WebStorageQuotaTypeTemporary && storageType != bli
nk::WebStorageQuotaTypePersistent) { |
| 81 // Unknown storage type is requested. |
| 82 executionContext->postTask(StorageErrorCallback::CallbackTask::create(er
rorCallback, NotSupportedError)); |
| 83 return; |
| 84 } |
| 85 |
| 86 StorageQuotaClient::from(executionContext)->requestQuota(executionContext, s
torageType, newQuotaInBytes, successCallback, errorCallback); |
| 87 } |
| 88 |
74 StorageQuota::~StorageQuota() | 89 StorageQuota::~StorageQuota() |
75 { | 90 { |
76 } | 91 } |
77 | 92 |
78 } // namespace WebCore | 93 } // namespace WebCore |
OLD | NEW |