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

Unified Diff: Source/web/WebDragData.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/modules/filesystem/DOMFileSystemSync.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/web/WebDragData.cpp
diff --git a/Source/web/WebDragData.cpp b/Source/web/WebDragData.cpp
index 733f383095463becf2bbed4d14a604c81e50dc92..ce7d90381b7efd6d2bba2e345e722eb2a86f08fb 100644
--- a/Source/web/WebDragData.cpp
+++ b/Source/web/WebDragData.cpp
@@ -101,23 +101,31 @@ WebVector<WebDragData::Item> WebDragData::items() const
RefPtrWillBeRawPtr<blink::Blob> blob = originalItem->getAsFile();
if (blob->isFile()) {
File* file = toFile(blob.get());
- if (!file->path().isEmpty()) {
- item.storageType = Item::StorageTypeFilename;
- item.filenameData = file->path();
- item.displayNameData = file->name();
- } else if (!file->fileSystemURL().isEmpty()) {
- item.storageType = Item::StorageTypeFileSystemFile;
- item.fileSystemURL = file->fileSystemURL();
- item.fileSystemFileSize = file->size();
+ if (file->hasBackingFile()) {
+ if (file->userVisibility() == File::IsUserVisible) {
+ item.storageType = Item::StorageTypeFilename;
+ item.filenameData = file->path();
+ item.displayNameData = file->name();
+ } else {
+ item.storageType = Item::StorageTypeFileSystemFile;
+ item.fileSystemURL = file->fileSystemURL();
+ item.fileSystemFileSize = file->size();
+ }
} else {
- ASSERT_NOT_REACHED();
+ // FIXME: support dragging constructed Files across renderers, see http://crbug.com/394955
+ item.storageType = Item::StorageTypeString;
+ item.stringType = "text/plain";
+ item.stringData = file->name();
}
- } else
+ } else {
ASSERT_NOT_REACHED();
- } else
+ }
+ } else {
ASSERT_NOT_REACHED();
- } else
+ }
+ } else {
ASSERT_NOT_REACHED();
+ }
item.title = originalItem->title();
item.baseURL = originalItem->baseURL();
itemList.append(item);
« no previous file with comments | « Source/modules/filesystem/DOMFileSystemSync.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698