| 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 15 matching lines...) Expand all Loading... |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 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 "web/StorageQuotaClientImpl.h" | 31 #include "web/StorageQuotaClientImpl.h" |
| 32 | 32 |
| 33 #include "core/dom/Document.h" | 33 #include "core/dom/Document.h" |
| 34 #include "core/dom/ExecutionContext.h" | 34 #include "core/dom/ExecutionContext.h" |
| 35 #include "core/dom/TaskRunnerHelper.h" | 35 #include "core/dom/TaskRunnerHelper.h" |
| 36 #include "core/frame/WebLocalFrameBase.h" |
| 36 #include "modules/quota/DeprecatedStorageQuotaCallbacksImpl.h" | 37 #include "modules/quota/DeprecatedStorageQuotaCallbacksImpl.h" |
| 37 #include "modules/quota/StorageErrorCallback.h" | 38 #include "modules/quota/StorageErrorCallback.h" |
| 38 #include "modules/quota/StorageQuotaCallback.h" | 39 #include "modules/quota/StorageQuotaCallback.h" |
| 39 #include "public/platform/WebStorageQuotaType.h" | 40 #include "public/platform/WebStorageQuotaType.h" |
| 40 #include "public/web/WebFrameClient.h" | 41 #include "public/web/WebFrameClient.h" |
| 41 #include "web/WebLocalFrameImpl.h" | |
| 42 | 42 |
| 43 namespace blink { | 43 namespace blink { |
| 44 | 44 |
| 45 StorageQuotaClientImpl::StorageQuotaClientImpl() {} | 45 StorageQuotaClientImpl::StorageQuotaClientImpl() {} |
| 46 | 46 |
| 47 StorageQuotaClientImpl::~StorageQuotaClientImpl() {} | 47 StorageQuotaClientImpl::~StorageQuotaClientImpl() {} |
| 48 | 48 |
| 49 void StorageQuotaClientImpl::RequestQuota( | 49 void StorageQuotaClientImpl::RequestQuota( |
| 50 ScriptState* script_state, | 50 ScriptState* script_state, |
| 51 WebStorageQuotaType storage_type, | 51 WebStorageQuotaType storage_type, |
| 52 unsigned long long new_quota_in_bytes, | 52 unsigned long long new_quota_in_bytes, |
| 53 StorageQuotaCallback* success_callback, | 53 StorageQuotaCallback* success_callback, |
| 54 StorageErrorCallback* error_callback) { | 54 StorageErrorCallback* error_callback) { |
| 55 ExecutionContext* execution_context = ExecutionContext::From(script_state); | 55 ExecutionContext* execution_context = ExecutionContext::From(script_state); |
| 56 DCHECK(execution_context); | 56 DCHECK(execution_context); |
| 57 DCHECK(execution_context->IsDocument()) | 57 DCHECK(execution_context->IsDocument()) |
| 58 << "Quota requests are not supported in workers"; | 58 << "Quota requests are not supported in workers"; |
| 59 | 59 |
| 60 Document* document = ToDocument(execution_context); | 60 Document* document = ToDocument(execution_context); |
| 61 WebLocalFrameImpl* web_frame = | 61 WebLocalFrameBase* web_frame = |
| 62 WebLocalFrameImpl::FromFrame(document->GetFrame()); | 62 WebLocalFrameBase::FromFrame(document->GetFrame()); |
| 63 StorageQuotaCallbacks* callbacks = | 63 StorageQuotaCallbacks* callbacks = |
| 64 DeprecatedStorageQuotaCallbacksImpl::Create(success_callback, | 64 DeprecatedStorageQuotaCallbacksImpl::Create(success_callback, |
| 65 error_callback); | 65 error_callback); |
| 66 web_frame->Client()->RequestStorageQuota(storage_type, new_quota_in_bytes, | 66 web_frame->Client()->RequestStorageQuota(storage_type, new_quota_in_bytes, |
| 67 callbacks); | 67 callbacks); |
| 68 } | 68 } |
| 69 | 69 |
| 70 } // namespace blink | 70 } // namespace blink |
| OLD | NEW |