Chromium Code Reviews| Index: Source/core/fileapi/File.cpp |
| diff --git a/Source/core/fileapi/File.cpp b/Source/core/fileapi/File.cpp |
| index e541d7923cb1475bdd9063545c3ff44aad2159cb..58d1c5747a9c00a5c952e5c14273e46f124759a9 100644 |
| --- a/Source/core/fileapi/File.cpp |
| +++ b/Source/core/fileapi/File.cpp |
| @@ -31,6 +31,7 @@ |
| #include "core/fileapi/FilePropertyBag.h" |
| #include "platform/FileMetadata.h" |
| #include "platform/MIMETypeRegistry.h" |
| +#include "platform/blob/BlobData.h" |
| #include "public/platform/Platform.h" |
| #include "public/platform/WebFileUtilities.h" |
| #include "wtf/CurrentTime.h" |
| @@ -101,7 +102,6 @@ File* File::create(const HeapVector<BlobOrStringOrArrayBufferViewOrArrayBuffer>& |
| lastModified = static_cast<double>(options.lastModified()); |
| else |
| lastModified = currentTimeMS(); |
| - |
|
Stephen White
2015/08/27 19:10:47
Nit: spurious whitespace change?
xlai (Olivia)
2015/08/28 19:54:19
Acknowledged.
|
| ASSERT(options.hasEndings()); |
| bool normalizeLineEndingsToNative = options.endings() == "native"; |
| @@ -113,6 +113,19 @@ File* File::create(const HeapVector<BlobOrStringOrArrayBufferViewOrArrayBuffer>& |
| return File::create(fileName, lastModified, BlobDataHandle::create(blobData.release(), fileSize)); |
| } |
| +File* File::create(char* data, size_t bytes, const String& mimeType) |
| +{ |
| + ASSERT(data); |
| + |
| + OwnPtr<BlobData> blobData = BlobData::create(); |
| + blobData->setContentType(mimeType); |
| + blobData->appendBytes(data, bytes); |
| + long long blobSize = blobData->length(); |
| + |
| + // create blob as the type of file with two additional attributes -- name and lastModificationTime |
| + return File::create("", currentTimeMS(), BlobDataHandle::create(blobData.release(), blobSize)); |
|
Noel Gordon
2015/08/28 08:53:47
Mozilla returns a Blob, but Chrome returns a File
xlai (Olivia)
2015/08/28 19:54:19
I did make attempts to create Blob* instead of Fil
|
| +} |
| + |
| File* File::createWithRelativePath(const String& path, const String& relativePath) |
| { |
| File* file = new File(path, File::AllContentTypes, File::IsUserVisible); |