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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 static PassOwnPtr<BlobData> createBlobDataForFileSystemURL(const KURL& fileSyste
mURL, const FileMetadata& metadata) | 81 static PassOwnPtr<BlobData> createBlobDataForFileSystemURL(const KURL& fileSyste
mURL, const FileMetadata& metadata) |
82 { | 82 { |
83 OwnPtr<BlobData> blobData = BlobData::create(); | 83 OwnPtr<BlobData> blobData = BlobData::create(); |
84 blobData->setContentType(getContentTypeFromFileName(fileSystemURL.path(), Fi
le::WellKnownContentTypes)); | 84 blobData->setContentType(getContentTypeFromFileName(fileSystemURL.path(), Fi
le::WellKnownContentTypes)); |
85 blobData->appendFileSystemURL(fileSystemURL, 0, metadata.length, metadata.mo
dificationTime); | 85 blobData->appendFileSystemURL(fileSystemURL, 0, metadata.length, metadata.mo
dificationTime); |
86 return blobData.release(); | 86 return blobData.release(); |
87 } | 87 } |
88 | 88 |
89 PassRefPtrWillBeRawPtr<File> File::createWithRelativePath(const String& path, co
nst String& relativePath) | 89 PassRefPtrWillBeRawPtr<File> File::createWithRelativePath(const String& path, co
nst String& relativePath) |
90 { | 90 { |
91 RefPtrWillBeRawPtr<File> file = adoptRefWillBeNoop(new File(path, AllContent
Types)); | 91 RefPtrWillBeRawPtr<File> file = adoptRefWillBeNoop(new File(path, File::AllC
ontentTypes, File::IsUserVisible)); |
92 file->m_relativePath = relativePath; | 92 file->m_relativePath = relativePath; |
93 return file.release(); | 93 return file.release(); |
94 } | 94 } |
95 | 95 |
96 File::File(const String& path, ContentTypeLookupPolicy policy) | 96 File::File(const String& path, ContentTypeLookupPolicy policy, UserVisibility us
erVisibility) |
97 : Blob(BlobDataHandle::create(createBlobDataForFile(path, policy), -1)) | 97 : Blob(BlobDataHandle::create(createBlobDataForFile(path, policy), -1)) |
98 , m_hasBackingFile(true) | 98 , m_hasBackingFile(true) |
| 99 , m_userVisibility(userVisibility) |
99 , m_path(path) | 100 , m_path(path) |
100 , m_name(blink::Platform::current()->fileUtilities()->baseName(path)) | 101 , m_name(blink::Platform::current()->fileUtilities()->baseName(path)) |
101 , m_snapshotSize(-1) | 102 , m_snapshotSize(-1) |
102 , m_snapshotModificationTime(invalidFileTime()) | 103 , m_snapshotModificationTime(invalidFileTime()) |
103 { | 104 { |
104 ScriptWrappable::init(this); | 105 ScriptWrappable::init(this); |
105 } | 106 } |
106 | 107 |
107 File::File(const String& path, const String& name, ContentTypeLookupPolicy polic
y) | 108 File::File(const String& path, const String& name, ContentTypeLookupPolicy polic
y, UserVisibility userVisibility) |
108 : Blob(BlobDataHandle::create(createBlobDataForFileWithName(path, name, poli
cy), -1)) | 109 : Blob(BlobDataHandle::create(createBlobDataForFileWithName(path, name, poli
cy), -1)) |
109 , m_hasBackingFile(true) | 110 , m_hasBackingFile(true) |
| 111 , m_userVisibility(userVisibility) |
110 , m_path(path) | 112 , m_path(path) |
111 , m_name(name) | 113 , m_name(name) |
112 , m_snapshotSize(-1) | 114 , m_snapshotSize(-1) |
113 , m_snapshotModificationTime(invalidFileTime()) | 115 , m_snapshotModificationTime(invalidFileTime()) |
114 { | 116 { |
115 ScriptWrappable::init(this); | 117 ScriptWrappable::init(this); |
116 } | 118 } |
117 | 119 |
118 File::File(const String& path, const String& name, const String& relativePath, b
ool hasSnaphotData, uint64_t size, double lastModified, PassRefPtr<BlobDataHandl
e> blobDataHandle) | 120 File::File(const String& path, const String& name, const String& relativePath, b
ool hasSnaphotData, uint64_t size, double lastModified, PassRefPtr<BlobDataHandl
e> blobDataHandle) |
119 : Blob(blobDataHandle) | 121 : Blob(blobDataHandle) |
120 , m_hasBackingFile(!path.isEmpty() || !relativePath.isEmpty()) | 122 , m_hasBackingFile(!path.isEmpty() || !relativePath.isEmpty()) |
| 123 , m_userVisibility(File::IsNotUserVisible) |
121 , m_path(path) | 124 , m_path(path) |
122 , m_name(name) | 125 , m_name(name) |
123 , m_snapshotSize(hasSnaphotData ? static_cast<long long>(size) : -1) | 126 , m_snapshotSize(hasSnaphotData ? static_cast<long long>(size) : -1) |
124 , m_snapshotModificationTime(hasSnaphotData ? lastModified : invalidFileTime
()) | 127 , m_snapshotModificationTime(hasSnaphotData ? lastModified : invalidFileTime
()) |
125 , m_relativePath(relativePath) | 128 , m_relativePath(relativePath) |
126 { | 129 { |
127 ScriptWrappable::init(this); | 130 ScriptWrappable::init(this); |
128 } | 131 } |
129 | 132 |
130 File::File(const String& name, double modificationTime, PassRefPtr<BlobDataHandl
e> blobDataHandle) | 133 File::File(const String& name, double modificationTime, PassRefPtr<BlobDataHandl
e> blobDataHandle) |
131 : Blob(blobDataHandle) | 134 : Blob(blobDataHandle) |
132 , m_hasBackingFile(false) | 135 , m_hasBackingFile(false) |
| 136 , m_userVisibility(File::IsNotUserVisible) |
133 , m_name(name) | 137 , m_name(name) |
134 , m_snapshotSize(Blob::size()) | 138 , m_snapshotSize(Blob::size()) |
135 , m_snapshotModificationTime(modificationTime) | 139 , m_snapshotModificationTime(modificationTime) |
136 { | 140 { |
137 ScriptWrappable::init(this); | 141 ScriptWrappable::init(this); |
138 } | 142 } |
139 | 143 |
140 File::File(const String& name, const FileMetadata& metadata) | 144 File::File(const String& name, const FileMetadata& metadata) |
141 : Blob(BlobDataHandle::create(createBlobDataForFileWithMetadata(name, metada
ta), metadata.length)) | 145 : Blob(BlobDataHandle::create(createBlobDataForFileWithMetadata(name, metada
ta), metadata.length)) |
142 , m_hasBackingFile(true) | 146 , m_hasBackingFile(true) |
| 147 , m_userVisibility(File::IsNotUserVisible) |
143 , m_path(metadata.platformPath) | 148 , m_path(metadata.platformPath) |
144 , m_name(name) | 149 , m_name(name) |
145 , m_snapshotSize(metadata.length) | 150 , m_snapshotSize(metadata.length) |
146 , m_snapshotModificationTime(metadata.modificationTime) | 151 , m_snapshotModificationTime(metadata.modificationTime) |
147 { | 152 { |
148 ScriptWrappable::init(this); | 153 ScriptWrappable::init(this); |
149 } | 154 } |
150 | 155 |
151 File::File(const KURL& fileSystemURL, const FileMetadata& metadata) | 156 File::File(const KURL& fileSystemURL, const FileMetadata& metadata) |
152 : Blob(BlobDataHandle::create(createBlobDataForFileSystemURL(fileSystemURL,
metadata), metadata.length)) | 157 : Blob(BlobDataHandle::create(createBlobDataForFileSystemURL(fileSystemURL,
metadata), metadata.length)) |
153 , m_hasBackingFile(true) | 158 , m_hasBackingFile(true) |
| 159 , m_userVisibility(File::IsNotUserVisible) |
154 , m_name(decodeURLEscapeSequences(fileSystemURL.lastPathComponent())) | 160 , m_name(decodeURLEscapeSequences(fileSystemURL.lastPathComponent())) |
155 , m_fileSystemURL(fileSystemURL) | 161 , m_fileSystemURL(fileSystemURL) |
156 , m_snapshotSize(metadata.length) | 162 , m_snapshotSize(metadata.length) |
157 , m_snapshotModificationTime(metadata.modificationTime) | 163 , m_snapshotModificationTime(metadata.modificationTime) |
158 { | 164 { |
159 ScriptWrappable::init(this); | 165 ScriptWrappable::init(this); |
160 } | 166 } |
161 | 167 |
162 double File::lastModifiedDate() const | 168 double File::lastModifiedDate() const |
163 { | 169 { |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
264 captureSnapshot(size, modificationTime); | 270 captureSnapshot(size, modificationTime); |
265 if (!m_fileSystemURL.isEmpty()) { | 271 if (!m_fileSystemURL.isEmpty()) { |
266 blobData.appendFileSystemURL(m_fileSystemURL, 0, size, modificationTime)
; | 272 blobData.appendFileSystemURL(m_fileSystemURL, 0, size, modificationTime)
; |
267 return; | 273 return; |
268 } | 274 } |
269 ASSERT(!m_path.isEmpty()); | 275 ASSERT(!m_path.isEmpty()); |
270 blobData.appendFile(m_path, 0, size, modificationTime); | 276 blobData.appendFile(m_path, 0, size, modificationTime); |
271 } | 277 } |
272 | 278 |
273 } // namespace blink | 279 } // namespace blink |
OLD | NEW |