| 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 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 316 return formData.release(); | 316 return formData.release(); |
| 317 } | 317 } |
| 318 | 318 |
| 319 PairIterable<String, FormDataEntryValue>::IterationSource* FormData::startIterat
ion(ScriptState*, ExceptionState&) | 319 PairIterable<String, FormDataEntryValue>::IterationSource* FormData::startIterat
ion(ScriptState*, ExceptionState&) |
| 320 { | 320 { |
| 321 return new FormDataIterationSource(this); | 321 return new FormDataIterationSource(this); |
| 322 } | 322 } |
| 323 | 323 |
| 324 // ---------------------------------------------------------------- | 324 // ---------------------------------------------------------------- |
| 325 | 325 |
| 326 FormData::Entry::Entry(const CString& name, const CString& value) | |
| 327 : m_name(name) | |
| 328 , m_value(value) | |
| 329 { | |
| 330 } | |
| 331 | |
| 332 FormData::Entry::Entry(const CString& name, Blob* blob, const String& filename) | |
| 333 : m_name(name) | |
| 334 , m_blob(blob) | |
| 335 , m_filename(filename) | |
| 336 { | |
| 337 } | |
| 338 | |
| 339 DEFINE_TRACE(FormData::Entry) | 326 DEFINE_TRACE(FormData::Entry) |
| 340 { | 327 { |
| 341 visitor->trace(m_blob); | 328 visitor->trace(m_blob); |
| 342 } | 329 } |
| 343 | 330 |
| 344 bool FormData::Entry::isString() const | |
| 345 { | |
| 346 return !m_blob; | |
| 347 } | |
| 348 | |
| 349 bool FormData::Entry::isFile() const | |
| 350 { | |
| 351 return m_blob; | |
| 352 } | |
| 353 | |
| 354 Blob* FormData::Entry::blob() const | |
| 355 { | |
| 356 return m_blob.get(); | |
| 357 } | |
| 358 | |
| 359 File* FormData::Entry::file() const | 331 File* FormData::Entry::file() const |
| 360 { | 332 { |
| 361 ASSERT(blob()); | 333 ASSERT(blob()); |
| 362 // The spec uses the passed filename when inserting entries into the list. | 334 // The spec uses the passed filename when inserting entries into the list. |
| 363 // Here, we apply the filename (if present) as an override when extracting | 335 // Here, we apply the filename (if present) as an override when extracting |
| 364 // entries. | 336 // entries. |
| 365 // FIXME: Consider applying the name during insertion. | 337 // FIXME: Consider applying the name during insertion. |
| 366 | 338 |
| 367 if (blob()->isFile()) { | 339 if (blob()->isFile()) { |
| 368 File* file = toFile(blob()); | 340 File* file = toFile(blob()); |
| 369 if (filename().isNull()) | 341 if (filename().isNull()) |
| 370 return file; | 342 return file; |
| 371 return file->clone(filename()); | 343 return file->clone(filename()); |
| 372 } | 344 } |
| 373 | 345 |
| 374 String filename = m_filename; | 346 String filename = m_filename; |
| 375 if (filename.isNull()) | 347 if (filename.isNull()) |
| 376 filename = "blob"; | 348 filename = "blob"; |
| 377 return File::create(filename, currentTimeMS(), blob()->blobDataHandle()); | 349 return File::create(filename, currentTimeMS(), blob()->blobDataHandle()); |
| 378 } | 350 } |
| 379 | 351 |
| 380 } // namespace blink | 352 } // namespace blink |
| OLD | NEW |