Index: Source/core/fileapi/File.cpp |
diff --git a/Source/core/fileapi/File.cpp b/Source/core/fileapi/File.cpp |
index e541d7923cb1475bdd9063545c3ff44aad2159cb..6a99843c1733c2d4abcba52e6b8f8b1a8e458dd2 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(); |
- |
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(Vector<char>* encodedImage, const String& mimeType) |
+{ |
+ ASSERT(encodedImage); |
+ |
+ OwnPtr<BlobData> blobData = BlobData::create(); |
+ blobData->setContentType(mimeType); |
Justin Novosad
2015/08/13 21:03:40
your test should be checking that setting the mime
xlai (Olivia)
2015/08/20 19:46:44
Acknowledged. Planning to write one more layout te
|
+ blobData->appendBytes(encodedImage->data(), encodedImage->size()); |
+ 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)); |
+} |
+ |
File* File::createWithRelativePath(const String& path, const String& relativePath) |
{ |
File* file = new File(path, File::AllContentTypes, File::IsUserVisible); |