Index: Source/core/fileapi/File.h |
diff --git a/Source/core/fileapi/File.h b/Source/core/fileapi/File.h |
index 61891563658d8f1d49c6edee18be897e62128058..eca7fbebb4fca7a2d2cb4a1ef18562c0e98016a0 100644 |
--- a/Source/core/fileapi/File.h |
+++ b/Source/core/fileapi/File.h |
@@ -47,9 +47,12 @@ public: |
AllContentTypes, |
}; |
+ // The user should not be able to browse to some files, such as the ones generated by the Filesystem API. |
tkent
2014/07/23 01:19:58
nit: I recommend to wrap code comments in 80 colu
pwnall-personal
2014/07/23 06:58:21
Done.
|
+ enum UserVisibility { IsUserVisible, IsNotUserVisible }; |
+ |
static PassRefPtrWillBeRawPtr<File> create(const String& path, ContentTypeLookupPolicy policy = WellKnownContentTypes) |
{ |
- return adoptRefWillBeNoop(new File(path, policy)); |
+ return adoptRefWillBeNoop(new File(path, policy, File::IsUserVisible)); |
} |
static PassRefPtrWillBeRawPtr<File> create(const String& name, double modificationTime, PassRefPtr<BlobDataHandle> blobDataHandle) |
@@ -58,11 +61,11 @@ public: |
} |
// For deserialization. |
- static PassRefPtrWillBeRawPtr<File> create(const String& path, const String& name, const String& relativePath, bool hasSnaphotData, uint64_t size, double lastModified, PassRefPtr<BlobDataHandle> blobDataHandle) |
+ static PassRefPtrWillBeRawPtr<File> createFromSerialization(const String& path, const String& name, const String& relativePath, bool hasSnaphotData, uint64_t size, double lastModified, PassRefPtr<BlobDataHandle> blobDataHandle) |
{ |
return adoptRefWillBeNoop(new File(path, name, relativePath, hasSnaphotData, size, lastModified, blobDataHandle)); |
} |
- static PassRefPtrWillBeRawPtr<File> create(const String& path, const String& name, uint64_t size, double lastModified, PassRefPtr<BlobDataHandle> blobDataHandle) |
+ static PassRefPtrWillBeRawPtr<File> createFromIndexedSerialization(const String& path, const String& name, uint64_t size, double lastModified, PassRefPtr<BlobDataHandle> blobDataHandle) |
{ |
return adoptRefWillBeNoop(new File(path, name, String(), true, size, lastModified, blobDataHandle)); |
} |
@@ -88,8 +91,15 @@ public: |
static PassRefPtrWillBeRawPtr<File> createWithName(const String& path, const String& name, ContentTypeLookupPolicy policy = WellKnownContentTypes) |
{ |
if (name.isEmpty()) |
- return adoptRefWillBeNoop(new File(path, policy)); |
- return adoptRefWillBeNoop(new File(path, name, policy)); |
+ return adoptRefWillBeNoop(new File(path, policy, File::IsUserVisible)); |
+ return adoptRefWillBeNoop(new File(path, name, policy, File::IsUserVisible)); |
+ } |
+ |
+ static PassRefPtrWillBeRawPtr<File> createForFileSystemFile(const String& path, const String& name, ContentTypeLookupPolicy policy = WellKnownContentTypes) |
+ { |
+ if (name.isEmpty()) |
+ return adoptRefWillBeNoop(new File(path, policy, File::IsNotUserVisible)); |
+ return adoptRefWillBeNoop(new File(path, name, policy, File::IsNotUserVisible)); |
} |
virtual unsigned long long size() const OVERRIDE; |
@@ -107,6 +117,8 @@ public: |
// This returns the current date and time if the file's last modification date is not known (per spec: http://www.w3.org/TR/FileAPI/#dfn-lastModifiedDate). |
double lastModifiedDate() const; |
+ UserVisibility userVisibility() const { return m_userVisibility; } |
+ |
// Returns the relative path of this file in the context of a directory selection. |
const String& webkitRelativePath() const { return m_relativePath; } |
@@ -117,8 +129,8 @@ public: |
bool hasValidSnapshotMetadata() const { return m_snapshotSize >= 0; } |
private: |
- File(const String& path, ContentTypeLookupPolicy); |
- File(const String& path, const String& name, ContentTypeLookupPolicy); |
+ File(const String& path, ContentTypeLookupPolicy, UserVisibility); |
+ File(const String& path, const String& name, ContentTypeLookupPolicy, UserVisibility); |
File(const String& path, const String& name, const String& relativePath, bool hasSnaphotData, uint64_t size, double lastModified, PassRefPtr<BlobDataHandle>); |
File(const String& name, double modificationTime, PassRefPtr<BlobDataHandle>); |
File(const String& name, const FileMetadata&); |
@@ -133,6 +145,7 @@ private: |
#endif |
bool m_hasBackingFile; |
+ UserVisibility m_userVisibility; |
String m_path; |
String m_name; |