| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "config.h" | 5 #include "config.h" |
| 6 #include "modules/fetch/RequestInit.h" | 6 #include "modules/fetch/RequestInit.h" |
| 7 | 7 |
| 8 #include "bindings/core/v8/Dictionary.h" | 8 #include "bindings/core/v8/Dictionary.h" |
| 9 #include "bindings/core/v8/V8ArrayBuffer.h" | 9 #include "bindings/core/v8/V8ArrayBuffer.h" |
| 10 #include "bindings/core/v8/V8ArrayBufferView.h" | 10 #include "bindings/core/v8/V8ArrayBufferView.h" |
| 11 #include "bindings/core/v8/V8Binding.h" | 11 #include "bindings/core/v8/V8Binding.h" |
| 12 #include "bindings/core/v8/V8Blob.h" | 12 #include "bindings/core/v8/V8Blob.h" |
| 13 #include "bindings/core/v8/V8FormData.h" | 13 #include "bindings/core/v8/V8FormData.h" |
| 14 #include "bindings/core/v8/V8URLSearchParams.h" |
| 14 #include "core/fileapi/Blob.h" | 15 #include "core/fileapi/Blob.h" |
| 15 #include "core/html/FormData.h" | 16 #include "core/html/FormData.h" |
| 16 #include "modules/fetch/FetchBlobDataConsumerHandle.h" | 17 #include "modules/fetch/FetchBlobDataConsumerHandle.h" |
| 17 #include "modules/fetch/FetchFormDataConsumerHandle.h" | 18 #include "modules/fetch/FetchFormDataConsumerHandle.h" |
| 18 #include "modules/fetch/Headers.h" | 19 #include "modules/fetch/Headers.h" |
| 19 #include "platform/blob/BlobData.h" | 20 #include "platform/blob/BlobData.h" |
| 20 #include "platform/network/EncodedFormData.h" | 21 #include "platform/network/EncodedFormData.h" |
| 21 #include "platform/weborigin/ReferrerPolicy.h" | 22 #include "platform/weborigin/ReferrerPolicy.h" |
| 22 | 23 |
| 23 namespace blink { | 24 namespace blink { |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 } else if (V8Blob::hasInstance(v8Body, isolate)) { | 72 } else if (V8Blob::hasInstance(v8Body, isolate)) { |
| 72 RefPtr<BlobDataHandle> blobDataHandle = V8Blob::toImpl(v8::Local<v8::Obj
ect>::Cast(v8Body))->blobDataHandle(); | 73 RefPtr<BlobDataHandle> blobDataHandle = V8Blob::toImpl(v8::Local<v8::Obj
ect>::Cast(v8Body))->blobDataHandle(); |
| 73 contentType = blobDataHandle->type(); | 74 contentType = blobDataHandle->type(); |
| 74 body = FetchBlobDataConsumerHandle::create(context, blobDataHandle.relea
se()); | 75 body = FetchBlobDataConsumerHandle::create(context, blobDataHandle.relea
se()); |
| 75 } else if (V8FormData::hasInstance(v8Body, isolate)) { | 76 } else if (V8FormData::hasInstance(v8Body, isolate)) { |
| 76 RefPtr<EncodedFormData> formData = V8FormData::toImpl(v8::Local<v8::Obje
ct>::Cast(v8Body))->encodeMultiPartFormData(); | 77 RefPtr<EncodedFormData> formData = V8FormData::toImpl(v8::Local<v8::Obje
ct>::Cast(v8Body))->encodeMultiPartFormData(); |
| 77 // Here we handle formData->boundary() as a C-style string. See | 78 // Here we handle formData->boundary() as a C-style string. See |
| 78 // FormDataEncoder::generateUniqueBoundaryString. | 79 // FormDataEncoder::generateUniqueBoundaryString. |
| 79 contentType = AtomicString("multipart/form-data; boundary=", AtomicStrin
g::ConstructFromLiteral) + formData->boundary().data(); | 80 contentType = AtomicString("multipart/form-data; boundary=", AtomicStrin
g::ConstructFromLiteral) + formData->boundary().data(); |
| 80 body = FetchFormDataConsumerHandle::create(context, formData.release()); | 81 body = FetchFormDataConsumerHandle::create(context, formData.release()); |
| 82 } else if (V8URLSearchParams::hasInstance(v8Body, isolate)) { |
| 83 RefPtr<EncodedFormData> formData = V8URLSearchParams::toImpl(v8::Local<v
8::Object>::Cast(v8Body))->encodeFormData(); |
| 84 contentType = AtomicString("application/x-www-form-urlencoded;charset=UT
F-8", AtomicString::ConstructFromLiteral); |
| 85 body = FetchFormDataConsumerHandle::create(context, formData.release()); |
| 81 } else if (v8Body->IsString()) { | 86 } else if (v8Body->IsString()) { |
| 82 contentType = "text/plain;charset=UTF-8"; | 87 contentType = "text/plain;charset=UTF-8"; |
| 83 body = FetchFormDataConsumerHandle::create(toUSVString(isolate, v8Body,
exceptionState)); | 88 body = FetchFormDataConsumerHandle::create(toUSVString(isolate, v8Body,
exceptionState)); |
| 84 } | 89 } |
| 85 } | 90 } |
| 86 | 91 |
| 87 } | 92 } |
| OLD | NEW |