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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 return; | 62 return; |
63 } | 63 } |
64 | 64 |
65 SecurityOrigin* securityOrigin = executionContext->securityOrigin(); | 65 SecurityOrigin* securityOrigin = executionContext->securityOrigin(); |
66 if (securityOrigin->isUnique()) { | 66 if (securityOrigin->isUnique()) { |
67 executionContext->postTask(StorageErrorCallback::CallbackTask::create(er
rorCallback, NotSupportedError)); | 67 executionContext->postTask(StorageErrorCallback::CallbackTask::create(er
rorCallback, NotSupportedError)); |
68 return; | 68 return; |
69 } | 69 } |
70 | 70 |
71 KURL storagePartition = KURL(KURL(), securityOrigin->toString()); | 71 KURL storagePartition = KURL(KURL(), securityOrigin->toString()); |
72 OwnPtrWillBeRawPtr<StorageQuotaCallbacks> callbacks = DeprecatedStorageQuota
CallbacksImpl::create(successCallback, errorCallback); | 72 StorageQuotaCallbacks* callbacks = DeprecatedStorageQuotaCallbacksImpl::crea
te(successCallback, errorCallback); |
73 Platform::current()->queryStorageUsageAndQuota(storagePartition, storageType
, callbacks.release()); | 73 Platform::current()->queryStorageUsageAndQuota(storagePartition, storageType
, callbacks); |
74 } | 74 } |
75 | 75 |
76 void DeprecatedStorageQuota::requestQuota(ExecutionContext* executionContext, un
signed long long newQuotaInBytes, StorageQuotaCallback* successCallback, Storage
ErrorCallback* errorCallback) | 76 void DeprecatedStorageQuota::requestQuota(ExecutionContext* executionContext, un
signed long long newQuotaInBytes, StorageQuotaCallback* successCallback, Storage
ErrorCallback* errorCallback) |
77 { | 77 { |
78 ASSERT(executionContext); | 78 ASSERT(executionContext); |
79 | 79 |
80 WebStorageQuotaType storageType = static_cast<WebStorageQuotaType>(m_type); | 80 WebStorageQuotaType storageType = static_cast<WebStorageQuotaType>(m_type); |
81 if (storageType != WebStorageQuotaTypeTemporary && storageType != WebStorage
QuotaTypePersistent) { | 81 if (storageType != WebStorageQuotaTypeTemporary && storageType != WebStorage
QuotaTypePersistent) { |
82 // Unknown storage type is requested. | 82 // Unknown storage type is requested. |
83 executionContext->postTask(StorageErrorCallback::CallbackTask::create(er
rorCallback, NotSupportedError)); | 83 executionContext->postTask(StorageErrorCallback::CallbackTask::create(er
rorCallback, NotSupportedError)); |
84 return; | 84 return; |
85 } | 85 } |
86 | 86 |
87 StorageQuotaClient* client = StorageQuotaClient::from(executionContext); | 87 StorageQuotaClient* client = StorageQuotaClient::from(executionContext); |
88 if (!client) { | 88 if (!client) { |
89 executionContext->postTask(StorageErrorCallback::CallbackTask::create(er
rorCallback, NotSupportedError)); | 89 executionContext->postTask(StorageErrorCallback::CallbackTask::create(er
rorCallback, NotSupportedError)); |
90 return; | 90 return; |
91 } | 91 } |
92 | 92 |
93 client->requestQuota(executionContext, storageType, newQuotaInBytes, success
Callback, errorCallback); | 93 client->requestQuota(executionContext, storageType, newQuotaInBytes, success
Callback, errorCallback); |
94 } | 94 } |
95 | 95 |
96 } // namespace blink | 96 } // namespace blink |
OLD | NEW |