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

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

Issue 2119863003: Revert of DevTools: protocol setting files properly handles mimetypes and directories. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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
Index: third_party/WebKit/Source/core/html/forms/FileInputType.cpp
diff --git a/third_party/WebKit/Source/core/html/forms/FileInputType.cpp b/third_party/WebKit/Source/core/html/forms/FileInputType.cpp
index 3bae496cd71ba5878d044be047db4c84553ceffb..98353fbca72a2cd287551efe12602637088a6d75 100644
--- a/third_party/WebKit/Source/core/html/forms/FileInputType.cpp
+++ b/third_party/WebKit/Source/core/html/forms/FileInputType.cpp
@@ -317,30 +317,34 @@
setFiles(createFileList(files, element().fastHasAttribute(webkitdirectoryAttr)));
}
-void FileInputType::setFilesFromDirectory(const String& path)
+void FileInputType::receiveDropForDirectoryUpload(const Vector<String>& paths)
{
if (ChromeClient* chromeClient = this->chromeClient()) {
FileChooserSettings settings;
HTMLInputElement& input = element();
settings.allowsDirectoryUpload = true;
settings.allowsMultipleFiles = true;
- settings.selectedFiles.append(path);
+ settings.selectedFiles.append(paths[0]);
settings.acceptMIMETypes = input.acceptMIMETypes();
settings.acceptFileExtensions = input.acceptFileExtensions();
chromeClient->enumerateChosenDirectory(newFileChooser(settings));
}
}
-void FileInputType::setFilesFromPaths(const Vector<String>& paths)
-{
+bool FileInputType::receiveDroppedFiles(const DragData* dragData)
+{
+ Vector<String> paths;
+ dragData->asFilePaths(paths);
if (paths.isEmpty())
- return;
+ return false;
HTMLInputElement& input = element();
if (input.fastHasAttribute(webkitdirectoryAttr)) {
- setFilesFromDirectory(paths[0]);
- return;
- }
+ receiveDropForDirectoryUpload(paths);
+ return true;
+ }
+
+ m_droppedFileSystemId = dragData->droppedFileSystemId();
Vector<FileChooserFileInfo> files;
for (unsigned i = 0; i < paths.size(); ++i)
@@ -353,19 +357,6 @@
firstFileOnly.append(files[0]);
filesChosen(firstFileOnly);
}
-}
-
-bool FileInputType::receiveDroppedFiles(const DragData* dragData)
-{
- Vector<String> paths;
- dragData->asFilePaths(paths);
- if (paths.isEmpty())
- return false;
-
- if (!element().fastHasAttribute(webkitdirectoryAttr)) {
- m_droppedFileSystemId = dragData->droppedFileSystemId();
- }
- setFilesFromPaths(paths);
return true;
}

Powered by Google App Engine
This is Rietveld 408576698