| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2014 Google Inc. All rights reserved. | 2 * Copyright (C) 2014 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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 for (size_t i = 0; i < WTF_ARRAY_LENGTH(storageTypeMappings); ++i) | 79 for (size_t i = 0; i < WTF_ARRAY_LENGTH(storageTypeMappings); ++i) |
| 80 types.append(storageTypeMappings[i].name); | 80 types.append(storageTypeMappings[i].name); |
| 81 return types; | 81 return types; |
| 82 } | 82 } |
| 83 | 83 |
| 84 ScriptPromise StorageQuota::queryInfo(ScriptState* scriptState, String type) | 84 ScriptPromise StorageQuota::queryInfo(ScriptState* scriptState, String type) |
| 85 { | 85 { |
| 86 ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptState)
; | 86 ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptState)
; |
| 87 ScriptPromise promise = resolver->promise(); | 87 ScriptPromise promise = resolver->promise(); |
| 88 | 88 |
| 89 SecurityOrigin* securityOrigin = scriptState->executionContext()->securityOr
igin(); | 89 SecurityOrigin* securityOrigin = scriptState->getExecutionContext()->getSecu
rityOrigin(); |
| 90 if (securityOrigin->isUnique()) { | 90 if (securityOrigin->isUnique()) { |
| 91 resolver->reject(DOMError::create(NotSupportedError)); | 91 resolver->reject(DOMError::create(NotSupportedError)); |
| 92 return promise; | 92 return promise; |
| 93 } | 93 } |
| 94 | 94 |
| 95 KURL storagePartition = KURL(KURL(), securityOrigin->toString()); | 95 KURL storagePartition = KURL(KURL(), securityOrigin->toString()); |
| 96 StorageQuotaCallbacks* callbacks = StorageQuotaCallbacksImpl::create(resolve
r); | 96 StorageQuotaCallbacks* callbacks = StorageQuotaCallbacksImpl::create(resolve
r); |
| 97 Platform::current()->queryStorageUsageAndQuota(storagePartition, stringToSto
rageQuotaType(type), callbacks); | 97 Platform::current()->queryStorageUsageAndQuota(storagePartition, stringToSto
rageQuotaType(type), callbacks); |
| 98 return promise; | 98 return promise; |
| 99 } | 99 } |
| 100 | 100 |
| 101 ScriptPromise StorageQuota::requestPersistentQuota(ScriptState* scriptState, uns
igned long long newQuota) | 101 ScriptPromise StorageQuota::requestPersistentQuota(ScriptState* scriptState, uns
igned long long newQuota) |
| 102 { | 102 { |
| 103 StorageQuotaClient* client = StorageQuotaClient::from(scriptState->execution
Context()); | 103 StorageQuotaClient* client = StorageQuotaClient::from(scriptState->getExecut
ionContext()); |
| 104 if (!client) { | 104 if (!client) { |
| 105 ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptSt
ate); | 105 ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptSt
ate); |
| 106 ScriptPromise promise = resolver->promise(); | 106 ScriptPromise promise = resolver->promise(); |
| 107 resolver->reject(DOMError::create(NotSupportedError)); | 107 resolver->reject(DOMError::create(NotSupportedError)); |
| 108 return promise; | 108 return promise; |
| 109 } | 109 } |
| 110 | 110 |
| 111 return client->requestPersistentQuota(scriptState, newQuota); | 111 return client->requestPersistentQuota(scriptState, newQuota); |
| 112 } | 112 } |
| 113 | 113 |
| 114 } // namespace blink | 114 } // namespace blink |
| OLD | NEW |