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 17 matching lines...) Expand all Loading... |
28 | 28 |
29 #include "core/fileapi/Blob.h" | 29 #include "core/fileapi/Blob.h" |
30 #include "platform/heap/Handle.h" | 30 #include "platform/heap/Handle.h" |
31 #include "wtf/PassRefPtr.h" | 31 #include "wtf/PassRefPtr.h" |
32 #include "wtf/text/WTFString.h" | 32 #include "wtf/text/WTFString.h" |
33 | 33 |
34 namespace blink { | 34 namespace blink { |
35 | 35 |
36 class ExceptionState; | 36 class ExceptionState; |
37 class ExecutionContext; | 37 class ExecutionContext; |
38 class FileMetadata; | 38 struct FileMetadata; |
39 class KURL; | 39 class KURL; |
40 | 40 |
41 class File final : public Blob { | 41 class File final : public Blob { |
42 DEFINE_WRAPPERTYPEINFO(); | 42 DEFINE_WRAPPERTYPEINFO(); |
43 public: | 43 public: |
44 // AllContentTypes should only be used when the full path/name are trusted;
otherwise, it could | 44 // AllContentTypes should only be used when the full path/name are trusted;
otherwise, it could |
45 // allow arbitrary pages to determine what applications an user has installe
d. | 45 // allow arbitrary pages to determine what applications an user has installe
d. |
46 enum ContentTypeLookupPolicy { | 46 enum ContentTypeLookupPolicy { |
47 WellKnownContentTypes, | 47 WellKnownContentTypes, |
48 AllContentTypes, | 48 AllContentTypes, |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 // Getter for the lastModifiedDate IDL attribute, | 125 // Getter for the lastModifiedDate IDL attribute, |
126 // http://www.w3.org/TR/FileAPI/#dfn-lastModifiedDate | 126 // http://www.w3.org/TR/FileAPI/#dfn-lastModifiedDate |
127 double lastModifiedDate() const; | 127 double lastModifiedDate() const; |
128 | 128 |
129 UserVisibility userVisibility() const { return m_userVisibility; } | 129 UserVisibility userVisibility() const { return m_userVisibility; } |
130 | 130 |
131 // Returns the relative path of this file in the context of a directory sele
ction. | 131 // Returns the relative path of this file in the context of a directory sele
ction. |
132 const String& webkitRelativePath() const { return m_relativePath; } | 132 const String& webkitRelativePath() const { return m_relativePath; } |
133 | 133 |
134 // Note that this involves synchronous file operation. Think twice before ca
lling this function. | 134 // Note that this involves synchronous file operation. Think twice before ca
lling this function. |
135 void captureSnapshot(long long& snapshotSize, double& snapshotModificationTi
meMS) const; | 135 void captureSnapshot(long long& snapshotSize, double& snapshotModificationTi
me) const; |
136 | 136 |
137 // Returns true if this has a valid snapshot metadata (i.e. m_snapshotSize >
= 0). | 137 // Returns true if this has a valid snapshot metadata (i.e. m_snapshotSize >
= 0). |
138 bool hasValidSnapshotMetadata() const { return m_snapshotSize >= 0; } | 138 bool hasValidSnapshotMetadata() const { return m_snapshotSize >= 0; } |
139 | 139 |
140 // Returns true if the sources (file path, file system URL, or blob handler)
of the file objects are same or not. | 140 // Returns true if the sources (file path, file system URL, or blob handler)
of the file objects are same or not. |
141 bool hasSameSource(const File& other) const; | 141 bool hasSameSource(const File& other) const; |
142 | 142 |
143 private: | 143 private: |
144 File(const String& path, ContentTypeLookupPolicy, UserVisibility); | 144 File(const String& path, ContentTypeLookupPolicy, UserVisibility); |
145 File(const String& path, const String& name, ContentTypeLookupPolicy, UserVi
sibility); | 145 File(const String& path, const String& name, ContentTypeLookupPolicy, UserVi
sibility); |
(...skipping 19 matching lines...) Expand all Loading... |
165 bool m_hasBackingFile; | 165 bool m_hasBackingFile; |
166 UserVisibility m_userVisibility; | 166 UserVisibility m_userVisibility; |
167 String m_path; | 167 String m_path; |
168 String m_name; | 168 String m_name; |
169 | 169 |
170 KURL m_fileSystemURL; | 170 KURL m_fileSystemURL; |
171 | 171 |
172 // If m_snapshotSize is negative (initialized to -1 by default), the snapsho
t metadata is invalid and we retrieve the latest metadata synchronously in size(
), lastModifiedTime() and slice(). | 172 // If m_snapshotSize is negative (initialized to -1 by default), the snapsho
t metadata is invalid and we retrieve the latest metadata synchronously in size(
), lastModifiedTime() and slice(). |
173 // Otherwise, the snapshot metadata are used directly in those methods. | 173 // Otherwise, the snapshot metadata are used directly in those methods. |
174 long long m_snapshotSize; | 174 long long m_snapshotSize; |
175 const double m_snapshotModificationTimeMS; | 175 const double m_snapshotModificationTime; |
176 | 176 |
177 String m_relativePath; | 177 String m_relativePath; |
178 }; | 178 }; |
179 | 179 |
180 DEFINE_TYPE_CASTS(File, Blob, blob, blob->isFile(), blob.isFile()); | 180 DEFINE_TYPE_CASTS(File, Blob, blob, blob->isFile(), blob.isFile()); |
181 | 181 |
182 } // namespace blink | 182 } // namespace blink |
183 | 183 |
184 #endif // File_h | 184 #endif // File_h |
OLD | NEW |