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

Unified Diff: Source/WebCore/fileapi/File.h

Issue 10821032: Merge 123495 - Files from drag and file <input> should use getMIMETypeForExtension to determine con… (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/1180/
Patch Set: Created 8 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 | « no previous file | Source/WebCore/fileapi/File.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/WebCore/fileapi/File.h
===================================================================
--- Source/WebCore/fileapi/File.h (revision 123676)
+++ Source/WebCore/fileapi/File.h (working copy)
@@ -38,9 +38,16 @@
class File : public Blob {
public:
- static PassRefPtr<File> create(const String& path)
+ // AllContentTypes should only be used when the full path/name are trusted; otherwise, it could
+ // allow arbitrary pages to determine what applications an user has installed.
+ enum ContentTypeLookupPolicy {
+ WellKnownContentTypes,
+ AllContentTypes,
+ };
+
+ static PassRefPtr<File> create(const String& path, ContentTypeLookupPolicy policy = WellKnownContentTypes)
{
- return adoptRef(new File(path));
+ return adoptRef(new File(path, policy));
}
// For deserialization.
@@ -64,11 +71,11 @@
#endif
// Create a file with a name exposed to the author (via File.name and associated DOM properties) that differs from the one provided in the path.
- static PassRefPtr<File> createWithName(const String& path, const String& name)
+ static PassRefPtr<File> createWithName(const String& path, const String& name, ContentTypeLookupPolicy policy = WellKnownContentTypes)
{
if (name.isEmpty())
- return adoptRef(new File(path));
- return adoptRef(new File(path, name));
+ return adoptRef(new File(path, policy));
+ return adoptRef(new File(path, name, policy));
}
virtual unsigned long long size() const;
@@ -89,11 +96,11 @@
void captureSnapshot(long long& snapshotSize, double& snapshotModificationTime) const;
private:
- File(const String& path);
+ File(const String& path, ContentTypeLookupPolicy);
// For deserialization.
File(const String& path, const KURL& srcURL, const String& type);
- File(const String& path, const String& name);
+ File(const String& path, const String& name, ContentTypeLookupPolicy);
# if ENABLE(FILE_SYSTEM)
File(const String& name, const FileMetadata&);
« no previous file with comments | « no previous file | Source/WebCore/fileapi/File.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698