| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 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 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 EncodedFormData::EncodingType encoding_type) { | 218 EncodedFormData::EncodingType encoding_type) { |
| 219 RefPtr<EncodedFormData> form_data = EncodedFormData::Create(); | 219 RefPtr<EncodedFormData> form_data = EncodedFormData::Create(); |
| 220 Vector<char> encoded_data; | 220 Vector<char> encoded_data; |
| 221 for (const auto& entry : Entries()) | 221 for (const auto& entry : Entries()) |
| 222 FormDataEncoder::AddKeyValuePairAsFormData( | 222 FormDataEncoder::AddKeyValuePairAsFormData( |
| 223 encoded_data, entry->name(), | 223 encoded_data, entry->name(), |
| 224 entry->isFile() ? EncodeAndNormalize(entry->GetFile()->name()) | 224 entry->isFile() ? EncodeAndNormalize(entry->GetFile()->name()) |
| 225 : entry->Value(), | 225 : entry->Value(), |
| 226 encoding_type); | 226 encoding_type); |
| 227 form_data->AppendData(encoded_data.data(), encoded_data.size()); | 227 form_data->AppendData(encoded_data.data(), encoded_data.size()); |
| 228 return form_data.Release(); | 228 return form_data; |
| 229 } | 229 } |
| 230 | 230 |
| 231 PassRefPtr<EncodedFormData> FormData::EncodeMultiPartFormData() { | 231 PassRefPtr<EncodedFormData> FormData::EncodeMultiPartFormData() { |
| 232 RefPtr<EncodedFormData> form_data = EncodedFormData::Create(); | 232 RefPtr<EncodedFormData> form_data = EncodedFormData::Create(); |
| 233 form_data->SetBoundary(FormDataEncoder::GenerateUniqueBoundaryString()); | 233 form_data->SetBoundary(FormDataEncoder::GenerateUniqueBoundaryString()); |
| 234 Vector<char> encoded_data; | 234 Vector<char> encoded_data; |
| 235 for (const auto& entry : Entries()) { | 235 for (const auto& entry : Entries()) { |
| 236 Vector<char> header; | 236 Vector<char> header; |
| 237 FormDataEncoder::BeginMultiPartHeader(header, form_data->Boundary().data(), | 237 FormDataEncoder::BeginMultiPartHeader(header, form_data->Boundary().data(), |
| 238 entry->name()); | 238 entry->name()); |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 294 entry->GetBlob()->GetBlobDataHandle()); | 294 entry->GetBlob()->GetBlobDataHandle()); |
| 295 } | 295 } |
| 296 } else { | 296 } else { |
| 297 form_data->AppendData(entry->Value().data(), entry->Value().length()); | 297 form_data->AppendData(entry->Value().data(), entry->Value().length()); |
| 298 } | 298 } |
| 299 form_data->AppendData("\r\n", 2); | 299 form_data->AppendData("\r\n", 2); |
| 300 } | 300 } |
| 301 FormDataEncoder::AddBoundaryToMultiPartHeader( | 301 FormDataEncoder::AddBoundaryToMultiPartHeader( |
| 302 encoded_data, form_data->Boundary().data(), true); | 302 encoded_data, form_data->Boundary().data(), true); |
| 303 form_data->AppendData(encoded_data.data(), encoded_data.size()); | 303 form_data->AppendData(encoded_data.data(), encoded_data.size()); |
| 304 return form_data.Release(); | 304 return form_data; |
| 305 } | 305 } |
| 306 | 306 |
| 307 PairIterable<String, FormDataEntryValue>::IterationSource* | 307 PairIterable<String, FormDataEntryValue>::IterationSource* |
| 308 FormData::StartIteration(ScriptState*, ExceptionState&) { | 308 FormData::StartIteration(ScriptState*, ExceptionState&) { |
| 309 return new FormDataIterationSource(this); | 309 return new FormDataIterationSource(this); |
| 310 } | 310 } |
| 311 | 311 |
| 312 // ---------------------------------------------------------------- | 312 // ---------------------------------------------------------------- |
| 313 | 313 |
| 314 DEFINE_TRACE(FormData::Entry) { | 314 DEFINE_TRACE(FormData::Entry) { |
| (...skipping 15 matching lines...) Expand all Loading... |
| 330 } | 330 } |
| 331 | 331 |
| 332 String filename = filename_; | 332 String filename = filename_; |
| 333 if (filename.IsNull()) | 333 if (filename.IsNull()) |
| 334 filename = "blob"; | 334 filename = "blob"; |
| 335 return File::Create(filename, CurrentTimeMS(), | 335 return File::Create(filename, CurrentTimeMS(), |
| 336 GetBlob()->GetBlobDataHandle()); | 336 GetBlob()->GetBlobDataHandle()); |
| 337 } | 337 } |
| 338 | 338 |
| 339 } // namespace blink | 339 } // namespace blink |
| OLD | NEW |