summaryrefslogtreecommitdiffstats
path: root/webkit
diff options
context:
space:
mode:
authormichaeln@chromium.org <michaeln@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-02-15 21:07:57 +0000
committermichaeln@chromium.org <michaeln@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-02-15 21:07:57 +0000
commit6df15b3fb7493528e01770a4ef66266e1229d5f9 (patch)
tree2cce80cc201b233251c2c303264d0c7c422863a6 /webkit
parent08351d95ed7b45863311807fbf9ace3b4a5e5231 (diff)
downloadchromium_src-6df15b3fb7493528e01770a4ef66266e1229d5f9.zip
chromium_src-6df15b3fb7493528e01770a4ef66266e1229d5f9.tar.gz
chromium_src-6df15b3fb7493528e01770a4ef66266e1229d5f9.tar.bz2
FileSystem mods: Changes to snapshot file creation to remove dependencies on blobs.
* Implementats of a new WebFileSystem::createSnapshotFileAndReadMetadata(...) method that does not take a blobURL as input and that invokes a new WebFileSystemCallbacks::didCreateSnapshotFile(...) in response instead of overloading the didReadMetadata callback for that purpose. * Leaves the existing handling in place since its still in use by WK. This CL is the 2nd in a series of changes that straddle webkit vs chromium repositories. 1) WK: Declare new virtual createSnapshotFile/didCreateSnapshotFile public api methods. 2) CR: Implement the new create method such that the didCreate method is invoked in response. 3) WK: Use the new create method and implement the new didCreate method. 3) CR: Cleanup the obsolete/deprecated blocks of code. BUG=174200 Review URL: https://chromiumcodereview.appspot.com/12084077 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@182822 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-rw-r--r--webkit/fileapi/file_system_callback_dispatcher.h5
-rw-r--r--webkit/plugins/ppapi/file_callbacks.cc6
-rw-r--r--webkit/plugins/ppapi/file_callbacks.h3
-rw-r--r--webkit/tools/test_shell/simple_file_system.cc47
-rw-r--r--webkit/tools/test_shell/simple_file_system.h20
5 files changed, 75 insertions, 6 deletions
diff --git a/webkit/fileapi/file_system_callback_dispatcher.h b/webkit/fileapi/file_system_callback_dispatcher.h
index 990e633..bf5e7ea 100644
--- a/webkit/fileapi/file_system_callback_dispatcher.h
+++ b/webkit/fileapi/file_system_callback_dispatcher.h
@@ -32,6 +32,11 @@ class WEBKIT_STORAGE_EXPORT FileSystemCallbackDispatcher {
const base::PlatformFileInfo& file_info,
const base::FilePath& platform_path) = 0;
+ // Callback to report information for a file and its actual file path.
+ virtual void DidCreateSnapshotFile(
+ const base::PlatformFileInfo& file_info,
+ const base::FilePath& platform_path) = 0;
+
// Callback to report the contents of a directory. If the contents of
// the given directory are reported in one batch, then |entries| will have
// the list of all files/directories in the given directory, |has_more| will
diff --git a/webkit/plugins/ppapi/file_callbacks.cc b/webkit/plugins/ppapi/file_callbacks.cc
index 5582d39..9e3ff7c 100644
--- a/webkit/plugins/ppapi/file_callbacks.cc
+++ b/webkit/plugins/ppapi/file_callbacks.cc
@@ -62,6 +62,12 @@ void FileCallbacks::DidReadMetadata(
callback_->Run(PP_OK);
}
+void FileCallbacks::DidCreateSnapshotFile(
+ const base::PlatformFileInfo& file_info,
+ const base::FilePath& path) {
+ NOTREACHED();
+}
+
void FileCallbacks::DidReadDirectory(
const std::vector<base::FileUtilProxy::Entry>& entries, bool has_more) {
NOTREACHED();
diff --git a/webkit/plugins/ppapi/file_callbacks.h b/webkit/plugins/ppapi/file_callbacks.h
index bfa10d5..3ba51c1 100644
--- a/webkit/plugins/ppapi/file_callbacks.h
+++ b/webkit/plugins/ppapi/file_callbacks.h
@@ -46,6 +46,9 @@ class FileCallbacks : public fileapi::FileSystemCallbackDispatcher {
virtual void DidReadMetadata(
const base::PlatformFileInfo& file_info,
const base::FilePath& unused);
+ virtual void DidCreateSnapshotFile(
+ const base::PlatformFileInfo& file_info,
+ const base::FilePath& path);
virtual void DidReadDirectory(
const std::vector<base::FileUtilProxy::Entry>& entries, bool has_more);
virtual void DidOpenFileSystem(const std::string&,
diff --git a/webkit/tools/test_shell/simple_file_system.cc b/webkit/tools/test_shell/simple_file_system.cc
index 27ea5f7..df438bb 100644
--- a/webkit/tools/test_shell/simple_file_system.cc
+++ b/webkit/tools/test_shell/simple_file_system.cc
@@ -239,6 +239,19 @@ WebFileWriter* SimpleFileSystem::createFileWriter(
}
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 @@ void SimpleFileSystem::createSnapshotFileAndReadMetadata(
return;
}
GetNewOperation(url)->CreateSnapshotFile(
- url, SnapshotFileHandler(blobURL, callbacks));
+ url, SnapshotFileHandler_Deprecated(blobURL, callbacks));
}
// static
@@ -307,9 +320,17 @@ SimpleFileSystem::DeleteFileSystemHandler(WebFileSystemCallbacks* callbacks) {
}
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::DidDeleteFileSystem(
}
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,
diff --git a/webkit/tools/test_shell/simple_file_system.h b/webkit/tools/test_shell/simple_file_system.h
index 099aeba..12adb7e 100644
--- a/webkit/tools/test_shell/simple_file_system.h
+++ b/webkit/tools/test_shell/simple_file_system.h
@@ -88,9 +88,14 @@ class SimpleFileSystem
virtual WebKit::WebFileWriter* createFileWriter(
const WebKit::WebURL& path, WebKit::WebFileWriterClient*) OVERRIDE;
virtual void createSnapshotFileAndReadMetadata(
+ const WebKit::WebURL& path,
+ WebKit::WebFileSystemCallbacks* callbacks);
+
+ // DEPRECATED
+ virtual void createSnapshotFileAndReadMetadata(
const WebKit::WebURL& blobURL,
const WebKit::WebURL& path,
- WebKit::WebFileSystemCallbacks* callbacks) OVERRIDE;
+ WebKit::WebFileSystemCallbacks* callbacks);
static void InitializeOnIOThread(
webkit_blob::BlobStorageController* blob_storage_controller);
@@ -121,8 +126,11 @@ class SimpleFileSystem
fileapi::FileSystemContext::DeleteFileSystemCallback DeleteFileSystemHandler(
WebKit::WebFileSystemCallbacks* callbacks);
fileapi::FileSystemOperation::SnapshotFileCallback
- SnapshotFileHandler(const GURL& blob_url,
- WebKit::WebFileSystemCallbacks* callbacks);
+ SnapshotFileHandler(WebKit::WebFileSystemCallbacks* callbacks);
+ fileapi::FileSystemOperation::SnapshotFileCallback
+ SnapshotFileHandler_Deprecated(
+ const GURL& blob_url,
+ WebKit::WebFileSystemCallbacks* callbacks);
void DidFinish(WebKit::WebFileSystemCallbacks* callbacks,
base::PlatformFileError result);
void DidGetMetadata(WebKit::WebFileSystemCallbacks* callbacks,
@@ -140,6 +148,12 @@ class SimpleFileSystem
void DidDeleteFileSystem(WebKit::WebFileSystemCallbacks* callbacks,
base::PlatformFileError result);
void DidCreateSnapshotFile(
+ WebKit::WebFileSystemCallbacks* callbacks,
+ base::PlatformFileError result,
+ const base::PlatformFileInfo& info,
+ const base::FilePath& platform_path,
+ const scoped_refptr<webkit_blob::ShareableFileReference>& file_ref);
+ void DidCreateSnapshotFile_Deprecated(
const GURL& blob_url,
WebKit::WebFileSystemCallbacks* callbacks,
base::PlatformFileError result,