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

Unified Diff: Source/core/page/DragController.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
« no previous file with comments | « Source/core/html/forms/FileInputTypeTest.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/page/DragController.cpp
diff --git a/Source/core/page/DragController.cpp b/Source/core/page/DragController.cpp
index 9922972e925b2faf9ce06daf72a423bef758ea09..bc4eb153004acc128c1832636c02f526c1a3f00f 100644
--- a/Source/core/page/DragController.cpp
+++ b/Source/core/page/DragController.cpp
@@ -54,6 +54,7 @@
#include "core/html/HTMLFormElement.h"
#include "core/html/HTMLInputElement.h"
#include "core/html/HTMLPlugInElement.h"
+#include "core/html/forms/FileInputType.h"
tkent 2014/11/17 05:21:37 Please do not include FileInputType.h here. *Inpu
hirono 2014/11/17 05:59:25 Done.
#include "core/loader/FrameLoadRequest.h"
#include "core/loader/FrameLoader.h"
#include "core/page/DragClient.h"
@@ -385,16 +386,18 @@ bool DragController::tryDocumentDrag(DragData* dragData, DragDestinationAction a
dragSession.mouseIsOverFileInput = m_fileInputElementUnderMouse;
dragSession.numberOfItemsToBeAccepted = 0;
- unsigned numberOfFiles = dragData->numberOfFiles();
+ Vector<String> paths;
+ FileInputType::getAcceptableDropFileNames(*dragData, &paths);
+ const unsigned numberOfFiles = paths.size();
if (m_fileInputElementUnderMouse) {
if (m_fileInputElementUnderMouse->isDisabledFormControl())
dragSession.numberOfItemsToBeAccepted = 0;
else if (m_fileInputElementUnderMouse->multiple())
dragSession.numberOfItemsToBeAccepted = numberOfFiles;
- else if (numberOfFiles > 1)
- dragSession.numberOfItemsToBeAccepted = 0;
- else
+ else if (numberOfFiles == 1)
dragSession.numberOfItemsToBeAccepted = 1;
+ else
+ dragSession.numberOfItemsToBeAccepted = 0;
if (!dragSession.numberOfItemsToBeAccepted)
dragSession.operation = DragOperationNone;
« no previous file with comments | « Source/core/html/forms/FileInputTypeTest.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698