Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(825)

Unified Diff: Source/core/fileapi/File.cpp

Issue 235373005: Handle JS-created files in <input type="file">. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fixed visibility bug. Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/fileapi/File.h ('k') | Source/core/fileapi/FileList.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/fileapi/File.cpp
diff --git a/Source/core/fileapi/File.cpp b/Source/core/fileapi/File.cpp
index 98ea833c4d5924404dd4488cf54fcdcbaf642210..426d709e62a787d002df792d790673fca60aca3f 100644
--- a/Source/core/fileapi/File.cpp
+++ b/Source/core/fileapi/File.cpp
@@ -88,14 +88,15 @@ static PassOwnPtr<BlobData> createBlobDataForFileSystemURL(const KURL& fileSyste
PassRefPtrWillBeRawPtr<File> File::createWithRelativePath(const String& path, const String& relativePath)
{
- RefPtrWillBeRawPtr<File> file = adoptRefWillBeNoop(new File(path, AllContentTypes));
+ RefPtrWillBeRawPtr<File> file = adoptRefWillBeNoop(new File(path, File::AllContentTypes, File::IsUserVisible));
file->m_relativePath = relativePath;
return file.release();
}
-File::File(const String& path, ContentTypeLookupPolicy policy)
+File::File(const String& path, ContentTypeLookupPolicy policy, UserVisibility userVisibility)
: Blob(BlobDataHandle::create(createBlobDataForFile(path, policy), -1))
, m_hasBackingFile(true)
+ , m_userVisibility(userVisibility)
, m_path(path)
, m_name(blink::Platform::current()->fileUtilities()->baseName(path))
, m_snapshotSize(-1)
@@ -104,9 +105,10 @@ File::File(const String& path, ContentTypeLookupPolicy policy)
ScriptWrappable::init(this);
}
-File::File(const String& path, const String& name, ContentTypeLookupPolicy policy)
+File::File(const String& path, const String& name, ContentTypeLookupPolicy policy, UserVisibility userVisibility)
: Blob(BlobDataHandle::create(createBlobDataForFileWithName(path, name, policy), -1))
, m_hasBackingFile(true)
+ , m_userVisibility(userVisibility)
, m_path(path)
, m_name(name)
, m_snapshotSize(-1)
@@ -118,6 +120,7 @@ File::File(const String& path, const String& name, ContentTypeLookupPolicy polic
File::File(const String& path, const String& name, const String& relativePath, bool hasSnaphotData, uint64_t size, double lastModified, PassRefPtr<BlobDataHandle> blobDataHandle)
: Blob(blobDataHandle)
, m_hasBackingFile(!path.isEmpty() || !relativePath.isEmpty())
+ , m_userVisibility(File::IsNotUserVisible)
, m_path(path)
, m_name(name)
, m_snapshotSize(hasSnaphotData ? static_cast<long long>(size) : -1)
@@ -130,6 +133,7 @@ File::File(const String& path, const String& name, const String& relativePath, b
File::File(const String& name, double modificationTime, PassRefPtr<BlobDataHandle> blobDataHandle)
: Blob(blobDataHandle)
, m_hasBackingFile(false)
+ , m_userVisibility(File::IsNotUserVisible)
, m_name(name)
, m_snapshotSize(Blob::size())
, m_snapshotModificationTime(modificationTime)
@@ -138,8 +142,9 @@ File::File(const String& name, double modificationTime, PassRefPtr<BlobDataHandl
}
File::File(const String& name, const FileMetadata& metadata)
- : Blob(BlobDataHandle::create(createBlobDataForFileWithMetadata(name, metadata), metadata.length))
+ : Blob(BlobDataHandle::create(createBlobDataForFileWithMetadata(name, metadata), metadata.length))
, m_hasBackingFile(true)
+ , m_userVisibility(File::IsNotUserVisible)
, m_path(metadata.platformPath)
, m_name(name)
, m_snapshotSize(metadata.length)
@@ -151,6 +156,7 @@ File::File(const String& name, const FileMetadata& metadata)
File::File(const KURL& fileSystemURL, const FileMetadata& metadata)
: Blob(BlobDataHandle::create(createBlobDataForFileSystemURL(fileSystemURL, metadata), metadata.length))
, m_hasBackingFile(true)
+ , m_userVisibility(File::IsNotUserVisible)
, m_name(decodeURLEscapeSequences(fileSystemURL.lastPathComponent()))
, m_fileSystemURL(fileSystemURL)
, m_snapshotSize(metadata.length)
« no previous file with comments | « Source/core/fileapi/File.h ('k') | Source/core/fileapi/FileList.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698