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

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

Issue 640723006: Pass the selected non-native file information from the browser to FileInputType. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 2 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 | « no previous file | Source/platform/FileChooser.h » ('j') | Source/platform/FileChooser.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/html/forms/FileInputType.cpp
diff --git a/Source/core/html/forms/FileInputType.cpp b/Source/core/html/forms/FileInputType.cpp
index 5c74604d1c3ab71f6f326edf3f8fe3683e0e25ab..7f55b7f70a78b8751a031e508da91512cc86c562 100644
--- a/Source/core/html/forms/FileInputType.cpp
+++ b/Source/core/html/forms/FileInputType.cpp
@@ -245,8 +245,13 @@ FileList* FileInputType::createFileList(const Vector<FileChooserFileInfo>& files
return fileList;
}
- for (size_t i = 0; i < size; i++)
- fileList->append(File::createForUserProvidedFile(files[i].path, files[i].displayName));
+ for (size_t i = 0; i < size; i++) {
tkent 2014/10/17 00:20:22 nit: We prefer |++i|.
hirono 2014/10/17 09:30:58 Done.
+ if (files[i].fileSystemURL.isNull()) {
tkent 2014/10/17 00:20:22 Why do you use isNull() though WebFileChooserCompl
hirono 2014/10/17 09:30:58 It should be isEmpty(). Done.
+ fileList->append(File::createForUserProvidedFile(files[i].path, files[i].displayName));
+ } else {
+ fileList->append(File::createForFileSystemFile(files[i].fileSystemURL, files[i].metadata));
+ }
+ }
return fileList;
tkent 2014/10/17 00:20:22 Please add unit test for FileInputType::createFile
hirono 2014/10/17 09:30:58 Done.
}
@@ -281,13 +286,15 @@ void FileInputType::setFiles(FileList* files)
RefPtrWillBeRawPtr<HTMLInputElement> input(element());
- bool pathsChanged = false;
+ bool filesChanged = false;
if (files->length() != m_fileList->length()) {
- pathsChanged = true;
+ filesChanged = true;
} else {
for (unsigned i = 0; i < files->length(); ++i) {
- if (files->item(i)->path() != m_fileList->item(i)->path()) {
- pathsChanged = true;
+ if (files->item(i)->hasBackingFile() != m_fileList->item(i)->hasBackingFile()
tkent 2014/10/17 00:20:22 We should introduce comparison member function, or
hirono 2014/10/17 09:30:58 Done.
+ || files->item(i)->path() != m_fileList->item(i)->path()
+ || files->item(i)->fileSystemURL() != m_fileList->item(i)->fileSystemURL()) {
+ filesChanged = true;
break;
}
}
@@ -301,7 +308,7 @@ void FileInputType::setFiles(FileList* files)
if (input->renderer())
input->renderer()->setShouldDoFullPaintInvalidation();
- if (pathsChanged) {
+ if (filesChanged) {
// This call may cause destruction of this instance.
// input instance is safe since it is ref-counted.
input->dispatchChangeEvent();
« no previous file with comments | « no previous file | Source/platform/FileChooser.h » ('j') | Source/platform/FileChooser.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698