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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 static PassRefPtrWillBeRawPtr<File> createFromIndexedSerialization(const Str
ing& path, const String& name, uint64_t size, double lastModified, PassRefPtr<Bl
obDataHandle> blobDataHandle) | 70 static PassRefPtrWillBeRawPtr<File> createFromIndexedSerialization(const Str
ing& path, const String& name, uint64_t size, double lastModified, PassRefPtr<Bl
obDataHandle> blobDataHandle) |
71 { | 71 { |
72 return adoptRefWillBeNoop(new File(path, name, String(), IsNotUserVisibl
e, true, size, lastModified, blobDataHandle)); | 72 return adoptRefWillBeNoop(new File(path, name, String(), IsNotUserVisibl
e, true, size, lastModified, blobDataHandle)); |
73 } | 73 } |
74 | 74 |
75 static PassRefPtrWillBeRawPtr<File> createWithRelativePath(const String& pat
h, const String& relativePath); | 75 static PassRefPtrWillBeRawPtr<File> createWithRelativePath(const String& pat
h, const String& relativePath); |
76 | 76 |
77 // 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. | 77 // 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. |
78 // | 78 // |
79 // Otherwise calling size(), lastModifiedTime() and slice() will synchronous
ly query the file metadata. | 79 // Otherwise calling size(), lastModifiedTime() and slice() will synchronous
ly query the file metadata. |
80 static PassRefPtrWillBeRawPtr<File> createForFileSystemFile(const String& na
me, const FileMetadata& metadata) | 80 static PassRefPtrWillBeRawPtr<File> createForFileSystemFile(const String& na
me, const FileMetadata& metadata, UserVisibility userVisibility) |
81 { | 81 { |
82 return adoptRefWillBeNoop(new File(name, metadata)); | 82 return adoptRefWillBeNoop(new File(name, metadata, userVisibility)); |
83 } | 83 } |
84 | 84 |
85 static PassRefPtrWillBeRawPtr<File> createForFileSystemFile(const KURL& url,
const FileMetadata& metadata) | 85 static PassRefPtrWillBeRawPtr<File> createForFileSystemFile(const KURL& url,
const FileMetadata& metadata) |
86 { | 86 { |
87 return adoptRefWillBeNoop(new File(url, metadata)); | 87 return adoptRefWillBeNoop(new File(url, metadata)); |
88 } | 88 } |
89 | 89 |
90 KURL fileSystemURL() const { ASSERT(hasValidFileSystemURL()); return m_fileS
ystemURL; } | 90 KURL fileSystemURL() const { ASSERT(hasValidFileSystemURL()); return m_fileS
ystemURL; } |
91 | 91 |
92 // Create a file with a name exposed to the author (via File.name and associ
ated DOM properties) that differs from the one provided in the path. | 92 // Create a file with a name exposed to the author (via File.name and associ
ated DOM properties) that differs from the one provided in the path. |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 void captureSnapshot(long long& snapshotSize, double& snapshotModificationTi
me) const; | 133 void captureSnapshot(long long& snapshotSize, double& snapshotModificationTi
me) const; |
134 | 134 |
135 // Returns true if this has a valid snapshot metadata (i.e. m_snapshotSize >
= 0). | 135 // Returns true if this has a valid snapshot metadata (i.e. m_snapshotSize >
= 0). |
136 bool hasValidSnapshotMetadata() const { return m_snapshotSize >= 0; } | 136 bool hasValidSnapshotMetadata() const { return m_snapshotSize >= 0; } |
137 | 137 |
138 private: | 138 private: |
139 File(const String& path, ContentTypeLookupPolicy, UserVisibility); | 139 File(const String& path, ContentTypeLookupPolicy, UserVisibility); |
140 File(const String& path, const String& name, ContentTypeLookupPolicy, UserVi
sibility); | 140 File(const String& path, const String& name, ContentTypeLookupPolicy, UserVi
sibility); |
141 File(const String& path, const String& name, const String& relativePath, Use
rVisibility, bool hasSnaphotData, uint64_t size, double lastModified, PassRefPtr
<BlobDataHandle>); | 141 File(const String& path, const String& name, const String& relativePath, Use
rVisibility, bool hasSnaphotData, uint64_t size, double lastModified, PassRefPtr
<BlobDataHandle>); |
142 File(const String& name, double modificationTime, PassRefPtr<BlobDataHandle>
); | 142 File(const String& name, double modificationTime, PassRefPtr<BlobDataHandle>
); |
143 File(const String& name, const FileMetadata&); | 143 File(const String& name, const FileMetadata&, UserVisibility); |
144 File(const KURL& fileSystemURL, const FileMetadata&); | 144 File(const KURL& fileSystemURL, const FileMetadata&); |
145 | 145 |
146 void invalidateSnapshotMetadata() { m_snapshotSize = -1; } | 146 void invalidateSnapshotMetadata() { m_snapshotSize = -1; } |
147 | 147 |
148 // Returns File's last modified time (in MS since Epoch.) | 148 // Returns File's last modified time (in MS since Epoch.) |
149 // If the modification time isn't known, the current time is returned. | 149 // If the modification time isn't known, the current time is returned. |
150 double lastModifiedMS() const; | 150 double lastModifiedMS() const; |
151 | 151 |
152 #if ENABLE(ASSERT) | 152 #if ENABLE(ASSERT) |
153 bool hasValidFileSystemURL() const { return hasBackingFile(); } | 153 bool hasValidFileSystemURL() const { return hasBackingFile(); } |
(...skipping 14 matching lines...) Expand all Loading... |
168 const double m_snapshotModificationTime; | 168 const double m_snapshotModificationTime; |
169 | 169 |
170 String m_relativePath; | 170 String m_relativePath; |
171 }; | 171 }; |
172 | 172 |
173 DEFINE_TYPE_CASTS(File, Blob, blob, blob->isFile(), blob.isFile()); | 173 DEFINE_TYPE_CASTS(File, Blob, blob, blob->isFile(), blob.isFile()); |
174 | 174 |
175 } // namespace blink | 175 } // namespace blink |
176 | 176 |
177 #endif // File_h | 177 #endif // File_h |
OLD | NEW |