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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 StorageQuotaCallbacks* callbacks = StorageQuotaCallbacksImpl::create(res
olver); | 84 StorageQuotaCallbacks* callbacks = StorageQuotaCallbacksImpl::create(res
olver); |
85 webFrame->client()->requestStorageQuota(webFrame, WebStorageQuotaTypePer
sistent, newQuotaInBytes, callbacks); | 85 webFrame->client()->requestStorageQuota(webFrame, WebStorageQuotaTypePer
sistent, newQuotaInBytes, callbacks); |
86 } else { | 86 } else { |
87 // Requesting quota in Worker is not supported. | 87 // Requesting quota in Worker is not supported. |
88 resolver->reject(DOMError::create(NotSupportedError)); | 88 resolver->reject(DOMError::create(NotSupportedError)); |
89 } | 89 } |
90 | 90 |
91 return promise; | 91 return promise; |
92 } | 92 } |
93 | 93 |
| 94 ScriptPromise StorageQuotaClientImpl::requestDurability(ScriptState* scriptState
) |
| 95 { |
| 96 RefPtrWillBeRawPtr<ScriptPromiseResolver> resolver = ScriptPromiseResolver::
create(scriptState); |
| 97 ScriptPromise promise = resolver->promise(); |
| 98 |
| 99 if (scriptState->executionContext()->isDocument()) { |
| 100 Document* document = toDocument(scriptState->executionContext()); |
| 101 WebLocalFrameImpl* webFrame = WebLocalFrameImpl::fromFrame(document->fra
me()); |
| 102 StorageQuotaCallbacks* callbacks = StorageQuotaCallbacksImpl::create(res
olver); |
| 103 webFrame->client()->requestDurability(webFrame, callbacks); |
| 104 } else { |
| 105 // Requesting quota in Worker is not supported. |
| 106 resolver->reject(DOMError::create(NotSupportedError)); |
| 107 } |
| 108 return promise; |
| 109 } |
| 110 |
94 } // namespace blink | 111 } // namespace blink |
OLD | NEW |