Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(63)

Side by Side Diff: Source/modules/filesystem/DOMFileSystemBase.cpp

Issue 516763002: Fix userVisibility for files in ChromeOS filesystems. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebased. Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2010 Google Inc. All rights reserved. 2 * Copyright (C) 2010 Google 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 are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 14 matching lines...) Expand all
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */ 29 */
30 30
31 #include "config.h" 31 #include "config.h"
32 #include "modules/filesystem/DOMFileSystemBase.h" 32 #include "modules/filesystem/DOMFileSystemBase.h"
33 33
34 #include "core/dom/ExecutionContext.h" 34 #include "core/dom/ExecutionContext.h"
35 #include "core/fileapi/File.h"
35 #include "core/fileapi/FileError.h" 36 #include "core/fileapi/FileError.h"
36 #include "core/html/VoidCallback.h" 37 #include "core/html/VoidCallback.h"
37 #include "modules/filesystem/DOMFilePath.h" 38 #include "modules/filesystem/DOMFilePath.h"
38 #include "modules/filesystem/DirectoryEntry.h" 39 #include "modules/filesystem/DirectoryEntry.h"
39 #include "modules/filesystem/DirectoryReaderBase.h" 40 #include "modules/filesystem/DirectoryReaderBase.h"
40 #include "modules/filesystem/EntriesCallback.h" 41 #include "modules/filesystem/EntriesCallback.h"
41 #include "modules/filesystem/Entry.h" 42 #include "modules/filesystem/Entry.h"
42 #include "modules/filesystem/EntryBase.h" 43 #include "modules/filesystem/EntryBase.h"
43 #include "modules/filesystem/EntryCallback.h" 44 #include "modules/filesystem/EntryCallback.h"
44 #include "modules/filesystem/ErrorCallback.h" 45 #include "modules/filesystem/ErrorCallback.h"
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 } 182 }
182 183
183 if (pathPrefix == externalPathPrefix) { 184 if (pathPrefix == externalPathPrefix) {
184 type = FileSystemTypeExternal; 185 type = FileSystemTypeExternal;
185 return true; 186 return true;
186 } 187 }
187 188
188 return false; 189 return false;
189 } 190 }
190 191
192 PassRefPtrWillBeRawPtr<File> DOMFileSystemBase::createFile(const FileMetadata& m etadata, const KURL& fileSystemURL, FileSystemType type, const String name)
193 {
194 // For regular filesystem types (temporary or persistent), we should not cac he file metadata as it could change File semantics.
195 // For other filesystem types (which could be platform-specific ones), there 's a chance that the files are on remote filesystem.
196 // If the port has returned metadata just pass it to File constructor (so we may cache the metadata).
197 // FIXME: We should use the snapshot metadata for all files.
198 // https://www.w3.org/Bugs/Public/show_bug.cgi?id=17746
199 if (type == FileSystemTypeTemporary || type == FileSystemTypePersistent)
200 return File::createForFileSystemFile(metadata.platformPath, name);
201
202 if (!metadata.platformPath.isEmpty()) {
203 // If the platformPath in the returned metadata is given, we create a Fi le object for the path.
204 File::UserVisibility userVisibility = (type == FileSystemTypeExternal) ? File::IsUserVisible : File::IsNotUserVisible;
205 return File::createForFileSystemFile(name, metadata, userVisibility);
206 }
207
208 return File::createForFileSystemFile(fileSystemURL, metadata);
209 }
210
191 void DOMFileSystemBase::getMetadata(const EntryBase* entry, PassOwnPtrWillBeRawP tr<MetadataCallback> successCallback, PassOwnPtrWillBeRawPtr<ErrorCallback> erro rCallback, SynchronousType synchronousType) 211 void DOMFileSystemBase::getMetadata(const EntryBase* entry, PassOwnPtrWillBeRawP tr<MetadataCallback> successCallback, PassOwnPtrWillBeRawPtr<ErrorCallback> erro rCallback, SynchronousType synchronousType)
192 { 212 {
193 if (!fileSystem()) { 213 if (!fileSystem()) {
194 reportError(errorCallback, FileError::create(FileError::ABORT_ERR)); 214 reportError(errorCallback, FileError::create(FileError::ABORT_ERR));
195 return; 215 return;
196 } 216 }
197 217
198 OwnPtr<AsyncFileSystemCallbacks> callbacks(MetadataCallbacks::create(success Callback, errorCallback, m_context, this)); 218 OwnPtr<AsyncFileSystemCallbacks> callbacks(MetadataCallbacks::create(success Callback, errorCallback, m_context, this));
199 callbacks->setShouldBlockUntilCompletion(synchronousType == Synchronous); 219 callbacks->setShouldBlockUntilCompletion(synchronousType == Synchronous);
200 fileSystem()->readMetadata(createFileSystemURL(entry), callbacks.release()); 220 fileSystem()->readMetadata(createFileSystemURL(entry), callbacks.release());
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
380 } 400 }
381 401
382 bool DOMFileSystemBase::waitForAdditionalResult(int callbacksId) 402 bool DOMFileSystemBase::waitForAdditionalResult(int callbacksId)
383 { 403 {
384 if (!fileSystem()) 404 if (!fileSystem())
385 return false; 405 return false;
386 return fileSystem()->waitForAdditionalResult(callbacksId); 406 return fileSystem()->waitForAdditionalResult(callbacksId);
387 } 407 }
388 408
389 } // namespace blink 409 } // namespace blink
OLDNEW
« no previous file with comments | « Source/modules/filesystem/DOMFileSystemBase.h ('k') | Source/modules/filesystem/DOMFileSystemBaseTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698