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

Side by Side Diff: trunk/Source/core/page/DragData.cpp

Issue 211853002: Revert 169711 "Prevent web content from forging File entries in ..." (Closed) Base URL: svn://svn.chromium.org/blink/
Patch Set: Created 6 years, 9 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « trunk/Source/core/page/DragData.h ('k') | trunk/Source/web/WebDragData.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2007 Apple Inc. All rights reserved. 2 * Copyright (C) 2007 Apple Inc. All rights reserved.
3 * Copyright (C) 2013 Google Inc. 3 * Copyright (C) 2013 Google Inc.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 } 62 }
63 63
64 static bool containsHTML(const DataObject* dropData) 64 static bool containsHTML(const DataObject* dropData)
65 { 65 {
66 return dropData->types().contains(mimeTypeTextHTML); 66 return dropData->types().contains(mimeTypeTextHTML);
67 } 67 }
68 68
69 bool DragData::containsURL(FilenameConversionPolicy filenamePolicy) const 69 bool DragData::containsURL(FilenameConversionPolicy filenamePolicy) const
70 { 70 {
71 return m_platformDragData->types().contains(mimeTypeTextURIList) 71 return m_platformDragData->types().contains(mimeTypeTextURIList)
72 || (filenamePolicy == ConvertFilenames 72 || (filenamePolicy == ConvertFilenames && m_platformDragData->containsFi lenames());
73 && (m_platformDragData->containsFilenames() || !m_platformDragData-> filenameForNavigation().isEmpty()));
74 } 73 }
75 74
76 String DragData::asURL(FilenameConversionPolicy filenamePolicy, String* title) c onst 75 String DragData::asURL(FilenameConversionPolicy filenamePolicy, String* title) c onst
77 { 76 {
78 String url; 77 String url;
79 if (m_platformDragData->types().contains(mimeTypeTextURIList)) { 78 if (m_platformDragData->types().contains(mimeTypeTextURIList))
80 m_platformDragData->urlAndTitle(url, title); 79 m_platformDragData->urlAndTitle(url, title);
81 } else if (filenamePolicy == ConvertFilenames) { 80 else if (filenamePolicy == ConvertFilenames && containsFiles())
82 if (containsFiles()) 81 url = filePathToURL(m_platformDragData->filenames()[0]);
83 url = filePathToURL(m_platformDragData->filenames()[0]);
84 else
85 url = filePathToURL(m_platformDragData->filenameForNavigation());
86 }
87 return url; 82 return url;
88 } 83 }
89 84
90 bool DragData::containsFiles() const 85 bool DragData::containsFiles() const
91 { 86 {
92 return m_platformDragData->containsFilenames(); 87 return m_platformDragData->containsFilenames();
93 } 88 }
94 89
95 unsigned DragData::numberOfFiles() const 90 unsigned DragData::numberOfFiles() const
96 { 91 {
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 163
169 String DragData::droppedFileSystemId() const 164 String DragData::droppedFileSystemId() const
170 { 165 {
171 DraggedIsolatedFileSystem* filesystem = DraggedIsolatedFileSystem::from(m_pl atformDragData); 166 DraggedIsolatedFileSystem* filesystem = DraggedIsolatedFileSystem::from(m_pl atformDragData);
172 if (!filesystem) 167 if (!filesystem)
173 return String(); 168 return String();
174 return filesystem->filesystemId(); 169 return filesystem->filesystemId();
175 } 170 }
176 171
177 } // namespace WebCore 172 } // namespace WebCore
OLDNEW
« no previous file with comments | « trunk/Source/core/page/DragData.h ('k') | trunk/Source/web/WebDragData.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698