| 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 |
| 326 DEFINE_TRACE(FormData::Entry) | 339 DEFINE_TRACE(FormData::Entry) |
| 327 { | 340 { |
| 328 visitor->trace(m_blob); | 341 visitor->trace(m_blob); |
| 329 } | 342 } |
| 330 | 343 |
| 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 |
| 331 File* FormData::Entry::file() const | 359 File* FormData::Entry::file() const |
| 332 { | 360 { |
| 333 ASSERT(blob()); | 361 ASSERT(blob()); |
| 334 // The spec uses the passed filename when inserting entries into the list. | 362 // The spec uses the passed filename when inserting entries into the list. |
| 335 // Here, we apply the filename (if present) as an override when extracting | 363 // Here, we apply the filename (if present) as an override when extracting |
| 336 // entries. | 364 // entries. |
| 337 // FIXME: Consider applying the name during insertion. | 365 // FIXME: Consider applying the name during insertion. |
| 338 | 366 |
| 339 if (blob()->isFile()) { | 367 if (blob()->isFile()) { |
| 340 File* file = toFile(blob()); | 368 File* file = toFile(blob()); |
| 341 if (filename().isNull()) | 369 if (filename().isNull()) |
| 342 return file; | 370 return file; |
| 343 return file->clone(filename()); | 371 return file->clone(filename()); |
| 344 } | 372 } |
| 345 | 373 |
| 346 String filename = m_filename; | 374 String filename = m_filename; |
| 347 if (filename.isNull()) | 375 if (filename.isNull()) |
| 348 filename = "blob"; | 376 filename = "blob"; |
| 349 return File::create(filename, currentTimeMS(), blob()->blobDataHandle()); | 377 return File::create(filename, currentTimeMS(), blob()->blobDataHandle()); |
| 350 } | 378 } |
| 351 | 379 |
| 352 } // namespace blink | 380 } // namespace blink |
| OLD | NEW |