Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(160)

Side by Side Diff: Source/modules/fetch/Response.cpp

Issue 1325893005: Rename DOMFormData to FormData. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/modules/fetch/RequestInit.cpp ('k') | Source/web/WebSearchableFormData.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/Response.h" 6 #include "modules/fetch/Response.h"
7 7
8 #include "bindings/core/v8/Dictionary.h" 8 #include "bindings/core/v8/Dictionary.h"
9 #include "bindings/core/v8/ExceptionState.h" 9 #include "bindings/core/v8/ExceptionState.h"
10 #include "core/dom/DOMArrayBuffer.h" 10 #include "core/dom/DOMArrayBuffer.h"
11 #include "core/dom/DOMArrayBufferView.h" 11 #include "core/dom/DOMArrayBufferView.h"
12 #include "core/fileapi/Blob.h" 12 #include "core/fileapi/Blob.h"
13 #include "core/html/DOMFormData.h" 13 #include "core/html/FormData.h"
14 #include "modules/fetch/BodyStreamBuffer.h" 14 #include "modules/fetch/BodyStreamBuffer.h"
15 #include "modules/fetch/FetchBlobDataConsumerHandle.h" 15 #include "modules/fetch/FetchBlobDataConsumerHandle.h"
16 #include "modules/fetch/ResponseInit.h" 16 #include "modules/fetch/ResponseInit.h"
17 #include "platform/network/EncodedFormData.h" 17 #include "platform/network/EncodedFormData.h"
18 #include "platform/network/HTTPHeaderMap.h" 18 #include "platform/network/HTTPHeaderMap.h"
19 #include "public/platform/WebServiceWorkerResponse.h" 19 #include "public/platform/WebServiceWorkerResponse.h"
20 #include "wtf/RefPtr.h" 20 #include "wtf/RefPtr.h"
21 21
22 namespace blink { 22 namespace blink {
23 23
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 } 123 }
124 if (body.isArrayBufferView()) { 124 if (body.isArrayBufferView()) {
125 RefPtr<DOMArrayBufferView> arrayBufferView = body.getAsArrayBufferView() ; 125 RefPtr<DOMArrayBufferView> arrayBufferView = body.getAsArrayBufferView() ;
126 OwnPtr<BlobData> blobData = BlobData::create(); 126 OwnPtr<BlobData> blobData = BlobData::create();
127 blobData->appendBytes(arrayBufferView->baseAddress(), arrayBufferView->b yteLength()); 127 blobData->appendBytes(arrayBufferView->baseAddress(), arrayBufferView->b yteLength());
128 const long long length = blobData->length(); 128 const long long length = blobData->length();
129 Blob* blob = Blob::create(BlobDataHandle::create(blobData.release(), len gth)); 129 Blob* blob = Blob::create(BlobDataHandle::create(blobData.release(), len gth));
130 return create(context, blob, ResponseInit(responseInit, exceptionState), exceptionState); 130 return create(context, blob, ResponseInit(responseInit, exceptionState), exceptionState);
131 } 131 }
132 if (body.isFormData()) { 132 if (body.isFormData()) {
133 DOMFormData* domFormData = body.getAsFormData(); 133 FormData* domFormData = body.getAsFormData();
134 OwnPtr<BlobData> blobData = BlobData::create(); 134 OwnPtr<BlobData> blobData = BlobData::create();
135 // FIXME: the same code exist in RequestInit::RequestInit(). 135 // FIXME: the same code exist in RequestInit::RequestInit().
136 RefPtr<EncodedFormData> httpBody = domFormData->createMultiPartFormData( ); 136 RefPtr<EncodedFormData> httpBody = domFormData->createMultiPartFormData( );
137 for (size_t i = 0; i < httpBody->elements().size(); ++i) { 137 for (size_t i = 0; i < httpBody->elements().size(); ++i) {
138 const FormDataElement& element = httpBody->elements()[i]; 138 const FormDataElement& element = httpBody->elements()[i];
139 switch (element.m_type) { 139 switch (element.m_type) {
140 case FormDataElement::data: { 140 case FormDataElement::data: {
141 blobData->appendBytes(element.m_data.data(), element.m_data.size ()); 141 blobData->appendBytes(element.m_data.data(), element.m_data.size ());
142 break; 142 break;
143 } 143 }
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after
399 } 399 }
400 400
401 DEFINE_TRACE(Response) 401 DEFINE_TRACE(Response)
402 { 402 {
403 Body::trace(visitor); 403 Body::trace(visitor);
404 visitor->trace(m_response); 404 visitor->trace(m_response);
405 visitor->trace(m_headers); 405 visitor->trace(m_headers);
406 } 406 }
407 407
408 } // namespace blink 408 } // namespace blink
OLDNEW
« no previous file with comments | « Source/modules/fetch/RequestInit.cpp ('k') | Source/web/WebSearchableFormData.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698