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

Unified Diff: Source/core/html/forms/FileInputType.cpp

Issue 720403002: Let input tag filter out non-native files in dropped data. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Change the behavior so that FileInputType does not accept non-native file drop data. Created 6 years, 1 month 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
Index: Source/core/html/forms/FileInputType.cpp
diff --git a/Source/core/html/forms/FileInputType.cpp b/Source/core/html/forms/FileInputType.cpp
index e26e55da239b8c0b749554b755b74ad80afc1be9..342cc44006a2a48b553df8b5ea4c014d2a6f5ef1 100644
--- a/Source/core/html/forms/FileInputType.cpp
+++ b/Source/core/html/forms/FileInputType.cpp
@@ -333,10 +333,21 @@ void FileInputType::receiveDropForDirectoryUpload(const Vector<String>& paths)
}
}
+void FileInputType::getAcceptableDropFileNames(const DragData& dragData, Vector<String>* result)
+{
+ result->clear();
+ Vector<String> paths;
+ dragData.asFilenames(paths);
+ for (const String path : paths) {
+ if (!path.isEmpty())
+ result->append(path);
+ }
+}
+
bool FileInputType::receiveDroppedFiles(const DragData* dragData)
{
Vector<String> paths;
- dragData->asFilenames(paths);
+ FileInputType::getAcceptableDropFileNames(*dragData, &paths);
if (paths.isEmpty())
return false;

Powered by Google App Engine
This is Rietveld 408576698