OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. | 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 WellKnownContentTypes, | 43 WellKnownContentTypes, |
44 AllContentTypes, | 44 AllContentTypes, |
45 }; | 45 }; |
46 | 46 |
47 static PassRefPtr<File> create(const String& path, ContentTypeLookupPolicy p
olicy = WellKnownContentTypes) | 47 static PassRefPtr<File> create(const String& path, ContentTypeLookupPolicy p
olicy = WellKnownContentTypes) |
48 { | 48 { |
49 return adoptRef(new File(path, policy)); | 49 return adoptRef(new File(path, policy)); |
50 } | 50 } |
51 | 51 |
52 // For deserialization. | 52 // For deserialization. |
53 static PassRefPtr<File> create(const String& path, const KURL& srcURL, const
String& type) | 53 static PassRefPtr<File> create(const String& path, PassRefPtr<BlobDataHandle
> blobDataHandle) |
54 { | 54 { |
55 return adoptRef(new File(path, srcURL, type)); | 55 return adoptRef(new File(path, blobDataHandle)); |
56 } | 56 } |
57 | 57 |
58 static PassRefPtr<File> createWithRelativePath(const String& path, const Str
ing& relativePath); | 58 static PassRefPtr<File> createWithRelativePath(const String& path, const Str
ing& relativePath); |
59 | 59 |
60 // If filesystem files live in the remote filesystem, the port might pass th
e valid metadata (whose length field is non-negative) and cache in the File obje
ct. | 60 // If filesystem files live in the remote filesystem, the port might pass th
e valid metadata (whose length field is non-negative) and cache in the File obje
ct. |
61 // | 61 // |
62 // Otherwise calling size(), lastModifiedTime() and slice() will synchronous
ly query the file metadata. | 62 // Otherwise calling size(), lastModifiedTime() and slice() will synchronous
ly query the file metadata. |
63 static PassRefPtr<File> createForFileSystemFile(const String& name, const Fi
leMetadata& metadata) | 63 static PassRefPtr<File> createForFileSystemFile(const String& name, const Fi
leMetadata& metadata) |
64 { | 64 { |
65 return adoptRef(new File(name, metadata)); | 65 return adoptRef(new File(name, metadata)); |
(...skipping 24 matching lines...) Expand all Loading... |
90 double lastModifiedDate() const; | 90 double lastModifiedDate() const; |
91 | 91 |
92 // Returns the relative path of this file in the context of a directory sele
ction. | 92 // Returns the relative path of this file in the context of a directory sele
ction. |
93 const String& webkitRelativePath() const { return m_relativePath; } | 93 const String& webkitRelativePath() const { return m_relativePath; } |
94 | 94 |
95 // Note that this involves synchronous file operation. Think twice before ca
lling this function. | 95 // Note that this involves synchronous file operation. Think twice before ca
lling this function. |
96 void captureSnapshot(long long& snapshotSize, double& snapshotModificationTi
me) const; | 96 void captureSnapshot(long long& snapshotSize, double& snapshotModificationTi
me) const; |
97 | 97 |
98 private: | 98 private: |
99 File(const String& path, ContentTypeLookupPolicy); | 99 File(const String& path, ContentTypeLookupPolicy); |
100 | |
101 // For deserialization. | |
102 File(const String& path, const KURL& srcURL, const String& type); | |
103 File(const String& path, const String& name, ContentTypeLookupPolicy); | 100 File(const String& path, const String& name, ContentTypeLookupPolicy); |
| 101 File(const String& path, PassRefPtr<BlobDataHandle>); |
104 File(const String& name, const FileMetadata&); | 102 File(const String& name, const FileMetadata&); |
105 File(const KURL& fileSystemURL, const FileMetadata&); | 103 File(const KURL& fileSystemURL, const FileMetadata&); |
106 | 104 |
107 // Returns true if this has a valid snapshot metadata (i.e. m_snapshotSize >
= 0). | 105 // Returns true if this has a valid snapshot metadata (i.e. m_snapshotSize >
= 0). |
108 bool hasValidSnapshotMetadata() const { return m_snapshotSize >= 0; } | 106 bool hasValidSnapshotMetadata() const { return m_snapshotSize >= 0; } |
109 | 107 |
110 String m_path; | 108 String m_path; |
111 String m_name; | 109 String m_name; |
112 | 110 |
113 KURL m_fileSystemURL; | 111 KURL m_fileSystemURL; |
(...skipping 14 matching lines...) Expand all Loading... |
128 | 126 |
129 inline const File* toFile(const Blob* blob) | 127 inline const File* toFile(const Blob* blob) |
130 { | 128 { |
131 ASSERT_WITH_SECURITY_IMPLICATION(!blob || blob->isFile()); | 129 ASSERT_WITH_SECURITY_IMPLICATION(!blob || blob->isFile()); |
132 return static_cast<const File*>(blob); | 130 return static_cast<const File*>(blob); |
133 } | 131 } |
134 | 132 |
135 } // namespace WebCore | 133 } // namespace WebCore |
136 | 134 |
137 #endif // File_h | 135 #endif // File_h |
OLD | NEW |