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

Unified Diff: webkit/tools/test_shell/simple_file_system.cc

Issue 12084077: FileSystem mods: Changes to snapshot file creation to remove dependencies on blobs. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 7 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webkit/tools/test_shell/simple_file_system.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/tools/test_shell/simple_file_system.cc
===================================================================
--- webkit/tools/test_shell/simple_file_system.cc (revision 182366)
+++ webkit/tools/test_shell/simple_file_system.cc (working copy)
@@ -239,6 +239,19 @@
}
void SimpleFileSystem::createSnapshotFileAndReadMetadata(
+ const WebURL& path,
+ WebFileSystemCallbacks* callbacks) {
+ FileSystemURL url(file_system_context()->CrackURL(path));
+ if (!HasFilePermission(url, FILE_PERMISSION_READ)) {
+ callbacks->didFail(WebKit::WebFileErrorSecurity);
+ return;
+ }
+ GetNewOperation(url)->CreateSnapshotFile(
+ url, SnapshotFileHandler(callbacks));
+}
+
+// DEPRECATED
+void SimpleFileSystem::createSnapshotFileAndReadMetadata(
const WebURL& blobURL,
const WebURL& path,
WebFileSystemCallbacks* callbacks) {
@@ -248,7 +261,7 @@
return;
}
GetNewOperation(url)->CreateSnapshotFile(
- url, SnapshotFileHandler(blobURL, callbacks));
+ url, SnapshotFileHandler_Deprecated(blobURL, callbacks));
}
// static
@@ -307,9 +320,17 @@
}
FileSystemOperation::SnapshotFileCallback
-SimpleFileSystem::SnapshotFileHandler(const GURL& blob_url,
- WebFileSystemCallbacks* callbacks) {
+SimpleFileSystem::SnapshotFileHandler(
+ WebFileSystemCallbacks* callbacks) {
return base::Bind(&SimpleFileSystem::DidCreateSnapshotFile,
+ AsWeakPtr(), base::Unretained(callbacks));
+}
+
+FileSystemOperation::SnapshotFileCallback
+SimpleFileSystem::SnapshotFileHandler_Deprecated(
+ const GURL& blob_url,
+ WebFileSystemCallbacks* callbacks) {
+ return base::Bind(&SimpleFileSystem::DidCreateSnapshotFile_Deprecated,
AsWeakPtr(), blob_url, base::Unretained(callbacks));
}
@@ -384,6 +405,26 @@
}
void SimpleFileSystem::DidCreateSnapshotFile(
+ WebFileSystemCallbacks* callbacks,
+ base::PlatformFileError result,
+ const base::PlatformFileInfo& info,
+ const base::FilePath& platform_path,
+ const scoped_refptr<webkit_blob::ShareableFileReference>& file_ref) {
+ if (result == base::PLATFORM_FILE_OK) {
+ WebFileInfo web_file_info;
+ web_file_info.length = info.size;
+ web_file_info.modificationTime = info.last_modified.ToDoubleT();
+ web_file_info.type = info.is_directory ?
+ WebFileInfo::TypeDirectory : WebFileInfo::TypeFile;
+ web_file_info.platformPath =
+ webkit_base::FilePathToWebString(platform_path);
+ callbacks->didCreateSnapshotFile(web_file_info);
+ } else {
+ callbacks->didFail(fileapi::PlatformFileErrorToWebFileError(result));
+ }
+}
+
+void SimpleFileSystem::DidCreateSnapshotFile_Deprecated(
const GURL& blob_url,
WebFileSystemCallbacks* callbacks,
base::PlatformFileError result,
« no previous file with comments | « webkit/tools/test_shell/simple_file_system.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698