summaryrefslogtreecommitdiffstats
path: root/webkit
diff options
context:
space:
mode:
authorericu@google.com <ericu@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-28 22:26:50 +0000
committerericu@google.com <ericu@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-28 22:26:50 +0000
commitbacef3cbbc55efebb2573194d329eabac5f5c7e3 (patch)
treecaa96791f328bb36601bcb839e6544f3cfdf8290 /webkit
parent748ce719f7594754695dfbd17b35618a58a5ffd1 (diff)
downloadchromium_src-bacef3cbbc55efebb2573194d329eabac5f5c7e3.zip
chromium_src-bacef3cbbc55efebb2573194d329eabac5f5c7e3.tar.gz
chromium_src-bacef3cbbc55efebb2573194d329eabac5f5c7e3.tar.bz2
Remove the path from PlatformFileInfo; it's cleaner just to pass it along as a
separate parameter, and not clutter up a base type. BUG:none TEST:none Review URL: http://codereview.chromium.org/6731033 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@79624 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-rw-r--r--webkit/fileapi/file_system_callback_dispatcher.h4
-rw-r--r--webkit/fileapi/file_system_file_util.cc5
-rw-r--r--webkit/fileapi/file_system_file_util.h4
-rw-r--r--webkit/fileapi/file_system_file_util_proxy.cc5
-rw-r--r--webkit/fileapi/file_system_file_util_proxy.h7
-rw-r--r--webkit/fileapi/file_system_operation.cc11
-rw-r--r--webkit/fileapi/file_system_operation.h9
-rw-r--r--webkit/fileapi/file_system_operation_unittest.cc16
-rw-r--r--webkit/fileapi/local_file_system_file_util.cc5
-rw-r--r--webkit/fileapi/local_file_system_file_util.h4
-rw-r--r--webkit/plugins/ppapi/file_callbacks.cc3
-rw-r--r--webkit/plugins/ppapi/file_callbacks.h4
-rw-r--r--webkit/tools/test_shell/simple_file_system.cc5
-rw-r--r--webkit/tools/test_shell/simple_file_writer.cc9
14 files changed, 63 insertions, 28 deletions
diff --git a/webkit/fileapi/file_system_callback_dispatcher.h b/webkit/fileapi/file_system_callback_dispatcher.h
index e5265bd..2bffe54 100644
--- a/webkit/fileapi/file_system_callback_dispatcher.h
+++ b/webkit/fileapi/file_system_callback_dispatcher.h
@@ -22,7 +22,9 @@ class FileSystemCallbackDispatcher {
virtual void DidSucceed() = 0;
// Callback to report information for a file.
- virtual void DidReadMetadata(const base::PlatformFileInfo& file_info) = 0;
+ virtual void DidReadMetadata(
+ const base::PlatformFileInfo& file_info,
+ const 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
diff --git a/webkit/fileapi/file_system_file_util.cc b/webkit/fileapi/file_system_file_util.cc
index 10af22f..1dceed2 100644
--- a/webkit/fileapi/file_system_file_util.cc
+++ b/webkit/fileapi/file_system_file_util.cc
@@ -61,12 +61,13 @@ PlatformFileError FileSystemFileUtil::EnsureFileExists(
PlatformFileError FileSystemFileUtil::GetFileInfo(
FileSystemOperationContext* unused,
const FilePath& file_path,
- base::PlatformFileInfo* file_info) {
+ base::PlatformFileInfo* file_info,
+ FilePath* platform_file_path) {
if (!file_util::PathExists(file_path))
return base::PLATFORM_FILE_ERROR_NOT_FOUND;
if (!file_util::GetFileInfo(file_path, file_info))
return base::PLATFORM_FILE_ERROR_FAILED;
- file_info->path = file_path;
+ *platform_file_path = file_path;
return base::PLATFORM_FILE_OK;
}
diff --git a/webkit/fileapi/file_system_file_util.h b/webkit/fileapi/file_system_file_util.h
index 620ff09..a208ae4 100644
--- a/webkit/fileapi/file_system_file_util.h
+++ b/webkit/fileapi/file_system_file_util.h
@@ -68,7 +68,9 @@ class FileSystemFileUtil {
// callback.
virtual PlatformFileError GetFileInfo(
FileSystemOperationContext* context,
- const FilePath& file_, base::PlatformFileInfo* file_info);
+ const FilePath& file_,
+ base::PlatformFileInfo* file_info,
+ FilePath* platform_path);
virtual PlatformFileError ReadDirectory(
FileSystemOperationContext* context,
diff --git a/webkit/fileapi/file_system_file_util_proxy.cc b/webkit/fileapi/file_system_file_util_proxy.cc
index faf3d4a..0f88ff0 100644
--- a/webkit/fileapi/file_system_file_util_proxy.cc
+++ b/webkit/fileapi/file_system_file_util_proxy.cc
@@ -208,11 +208,11 @@ class RelayGetFileInfo : public MessageLoopRelay {
virtual void RunWork() {
set_error_code(
file_system_file_util()->GetFileInfo(
- context(), file_path_, &file_info_));
+ context(), file_path_, &file_info_, &platform_path_));
}
virtual void RunCallback() {
- callback_->Run(error_code(), file_info_);
+ callback_->Run(error_code(), file_info_, platform_path_);
delete callback_;
}
@@ -220,6 +220,7 @@ class RelayGetFileInfo : public MessageLoopRelay {
fileapi::FileSystemFileUtilProxy::GetFileInfoCallback* callback_;
FilePath file_path_;
base::PlatformFileInfo file_info_;
+ FilePath platform_path_;
};
class RelayReadDirectory : public MessageLoopRelay {
diff --git a/webkit/fileapi/file_system_file_util_proxy.h b/webkit/fileapi/file_system_file_util_proxy.h
index 288d4cf..de4b320 100644
--- a/webkit/fileapi/file_system_file_util_proxy.h
+++ b/webkit/fileapi/file_system_file_util_proxy.h
@@ -25,6 +25,8 @@ class FileSystemOperationContext;
using base::MessageLoopProxy;
using base::PlatformFile;
+using base::PlatformFileError;
+using base::PlatformFileInfo;
// This class provides asynchronous access to common file routines for the
// FileSystem API.
@@ -34,7 +36,10 @@ class FileSystemFileUtilProxy {
typedef base::FileUtilProxy::CreateOrOpenCallback CreateOrOpenCallback;
typedef base::FileUtilProxy::EnsureFileExistsCallback
EnsureFileExistsCallback;
- typedef base::FileUtilProxy::GetFileInfoCallback GetFileInfoCallback;
+ typedef Callback3<PlatformFileError /* error code */,
+ const PlatformFileInfo& /* file_info */,
+ const FilePath& /* platform_path, where possible */
+ >::Type GetFileInfoCallback;
typedef base::FileUtilProxy::ReadDirectoryCallback ReadDirectoryCallback;
// Creates or opens a file with the given flags. It is invalid to pass NULL
diff --git a/webkit/fileapi/file_system_operation.cc b/webkit/fileapi/file_system_operation.cc
index 1555cd7..4ddfd0c 100644
--- a/webkit/fileapi/file_system_operation.cc
+++ b/webkit/fileapi/file_system_operation.cc
@@ -454,7 +454,8 @@ void FileSystemOperation::DidFinishFileOperation(
void FileSystemOperation::DidDirectoryExists(
base::PlatformFileError rv,
- const base::PlatformFileInfo& file_info) {
+ const base::PlatformFileInfo& file_info,
+ const FilePath& unused) {
if (rv == base::PLATFORM_FILE_OK) {
if (file_info.is_directory)
dispatcher_->DidSucceed();
@@ -468,7 +469,8 @@ void FileSystemOperation::DidDirectoryExists(
void FileSystemOperation::DidFileExists(
base::PlatformFileError rv,
- const base::PlatformFileInfo& file_info) {
+ const base::PlatformFileInfo& file_info,
+ const FilePath& unused) {
if (rv == base::PLATFORM_FILE_OK) {
if (file_info.is_directory)
dispatcher_->DidFail(base::PLATFORM_FILE_ERROR_NOT_A_FILE);
@@ -482,9 +484,10 @@ void FileSystemOperation::DidFileExists(
void FileSystemOperation::DidGetMetadata(
base::PlatformFileError rv,
- const base::PlatformFileInfo& file_info) {
+ const base::PlatformFileInfo& file_info,
+ const FilePath& platform_path) {
if (rv == base::PLATFORM_FILE_OK)
- dispatcher_->DidReadMetadata(file_info);
+ dispatcher_->DidReadMetadata(file_info, platform_path);
else
dispatcher_->DidFail(rv);
delete this;
diff --git a/webkit/fileapi/file_system_operation.h b/webkit/fileapi/file_system_operation.h
index 719ac8e..f6d2016 100644
--- a/webkit/fileapi/file_system_operation.h
+++ b/webkit/fileapi/file_system_operation.h
@@ -112,11 +112,14 @@ class FileSystemOperation {
void DidFinishFileOperation(base::PlatformFileError rv);
void DidDirectoryExists(base::PlatformFileError rv,
- const base::PlatformFileInfo& file_info);
+ const base::PlatformFileInfo& file_info,
+ const FilePath& unused);
void DidFileExists(base::PlatformFileError rv,
- const base::PlatformFileInfo& file_info);
+ const base::PlatformFileInfo& file_info,
+ const FilePath& unused);
void DidGetMetadata(base::PlatformFileError rv,
- const base::PlatformFileInfo& file_info);
+ const base::PlatformFileInfo& file_info,
+ const FilePath& platform_path);
void DidReadDirectory(
base::PlatformFileError rv,
const std::vector<base::FileUtilProxy::Entry>& entries);
diff --git a/webkit/fileapi/file_system_operation_unittest.cc b/webkit/fileapi/file_system_operation_unittest.cc
index 5641923..9cd128c 100644
--- a/webkit/fileapi/file_system_operation_unittest.cc
+++ b/webkit/fileapi/file_system_operation_unittest.cc
@@ -43,6 +43,8 @@ class FileSystemOperationTest : public testing::Test {
int status() const { return status_; }
void set_info(const base::PlatformFileInfo& info) { info_ = info; }
const base::PlatformFileInfo& info() const { return info_; }
+ void set_path(const FilePath& path) { path_ = path; }
+ const FilePath& path() const { return path_; }
void set_entries(const std::vector<base::FileUtilProxy::Entry>& entries) {
entries_ = entries;
}
@@ -57,6 +59,7 @@ class FileSystemOperationTest : public testing::Test {
// For post-operation status.
int status_;
base::PlatformFileInfo info_;
+ FilePath path_;
std::vector<base::FileUtilProxy::Entry> entries_;
DISALLOW_COPY_AND_ASSIGN(FileSystemOperationTest);
@@ -74,8 +77,11 @@ class MockDispatcher : public FileSystemCallbackDispatcher {
test_->set_status(kFileOperationSucceeded);
}
- virtual void DidReadMetadata(const base::PlatformFileInfo& info) {
+ virtual void DidReadMetadata(
+ const base::PlatformFileInfo& info,
+ const FilePath& platform_path) {
test_->set_info(info);
+ test_->set_path(platform_path);
test_->set_status(kFileOperationSucceeded);
}
@@ -564,6 +570,7 @@ TEST_F(FileSystemOperationTest, TestExistsAndMetadataSuccess) {
MessageLoop::current()->RunAllPending();
EXPECT_EQ(kFileOperationSucceeded, status());
EXPECT_TRUE(info().is_directory);
+ EXPECT_EQ(dir.path(), path());
FilePath file;
file_util::CreateTemporaryFileInDir(dir.path(), &file);
@@ -575,6 +582,7 @@ TEST_F(FileSystemOperationTest, TestExistsAndMetadataSuccess) {
MessageLoop::current()->RunAllPending();
EXPECT_EQ(kFileOperationSucceeded, status());
EXPECT_FALSE(info().is_directory);
+ EXPECT_EQ(file, path());
}
TEST_F(FileSystemOperationTest, TestTypeMismatchErrors) {
@@ -592,9 +600,9 @@ TEST_F(FileSystemOperationTest, TestTypeMismatchErrors) {
}
TEST_F(FileSystemOperationTest, TestReadDirFailure) {
- // Path doesn't exists
- FilePath nonexisting_dir_path(base_.path().Append(
- FILE_PATH_LITERAL("NonExistingDir")));
+ // Path doesn't exist
+ FilePath nonexisting_dir_path(base_.path().Append(
+ FILE_PATH_LITERAL("NonExistingDir")));
file_util::EnsureEndsWithSeparator(&nonexisting_dir_path);
operation()->ReadDirectory(nonexisting_dir_path);
MessageLoop::current()->RunAllPending();
diff --git a/webkit/fileapi/local_file_system_file_util.cc b/webkit/fileapi/local_file_system_file_util.cc
index 8def3f6..068a052 100644
--- a/webkit/fileapi/local_file_system_file_util.cc
+++ b/webkit/fileapi/local_file_system_file_util.cc
@@ -47,14 +47,15 @@ PlatformFileError LocalFileSystemFileUtil::EnsureFileExists(
PlatformFileError LocalFileSystemFileUtil::GetFileInfo(
FileSystemOperationContext* context,
const FilePath& file_path,
- base::PlatformFileInfo* file_info) {
+ base::PlatformFileInfo* file_info,
+ FilePath* platform_file_path) {
FilePath local_path =
GetLocalPath(context, context->src_origin_url(), context->src_type(),
file_path);
if (local_path.empty())
return base::PLATFORM_FILE_ERROR_INVALID_OPERATION;
return FileSystemFileUtil::GetInstance()->GetFileInfo(
- context, local_path, file_info);
+ context, local_path, file_info, platform_file_path);
}
PlatformFileError LocalFileSystemFileUtil::ReadDirectory(
diff --git a/webkit/fileapi/local_file_system_file_util.h b/webkit/fileapi/local_file_system_file_util.h
index 428b157..3e5855a 100644
--- a/webkit/fileapi/local_file_system_file_util.h
+++ b/webkit/fileapi/local_file_system_file_util.h
@@ -51,7 +51,9 @@ class LocalFileSystemFileUtil : public FileSystemFileUtil {
virtual PlatformFileError GetFileInfo(
FileSystemOperationContext* context,
- const FilePath& file_, base::PlatformFileInfo* file_info);
+ const FilePath& file_,
+ base::PlatformFileInfo* file_info,
+ FilePath* platform_file);
virtual PlatformFileError ReadDirectory(
FileSystemOperationContext* context,
diff --git a/webkit/plugins/ppapi/file_callbacks.cc b/webkit/plugins/ppapi/file_callbacks.cc
index 4c57f33..92d443b 100644
--- a/webkit/plugins/ppapi/file_callbacks.cc
+++ b/webkit/plugins/ppapi/file_callbacks.cc
@@ -44,7 +44,8 @@ void FileCallbacks::DidSucceed() {
}
void FileCallbacks::DidReadMetadata(
- const base::PlatformFileInfo& file_info) {
+ const base::PlatformFileInfo& file_info,
+ const FilePath& unused) {
if (callback_->completed())
return;
diff --git a/webkit/plugins/ppapi/file_callbacks.h b/webkit/plugins/ppapi/file_callbacks.h
index 284ff61..e0a129f 100644
--- a/webkit/plugins/ppapi/file_callbacks.h
+++ b/webkit/plugins/ppapi/file_callbacks.h
@@ -39,7 +39,9 @@ class FileCallbacks : public fileapi::FileSystemCallbackDispatcher {
// FileSystemCallbackDispatcher implementation.
virtual void DidSucceed();
- virtual void DidReadMetadata(const base::PlatformFileInfo& file_info);
+ virtual void DidReadMetadata(
+ const base::PlatformFileInfo& file_info,
+ const FilePath& unused);
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 8fbc101..ecbc6d5 100644
--- a/webkit/tools/test_shell/simple_file_system.cc
+++ b/webkit/tools/test_shell/simple_file_system.cc
@@ -64,7 +64,8 @@ class SimpleFileSystemCallbackDispatcher
callbacks_->didSucceed();
}
- virtual void DidReadMetadata(const base::PlatformFileInfo& info) {
+ virtual void DidReadMetadata(const base::PlatformFileInfo& info,
+ const FilePath& platform_path) {
DCHECK(file_system_);
WebFileInfo web_file_info;
web_file_info.length = info.size;
@@ -72,7 +73,7 @@ class SimpleFileSystemCallbackDispatcher
web_file_info.type = info.is_directory ?
WebFileInfo::TypeDirectory : WebFileInfo::TypeFile;
web_file_info.platformPath =
- webkit_glue::FilePathToWebString(info.path);
+ webkit_glue::FilePathToWebString(platform_path);
callbacks_->didReadMetadata(web_file_info);
}
diff --git a/webkit/tools/test_shell/simple_file_writer.cc b/webkit/tools/test_shell/simple_file_writer.cc
index e245b63..9304978 100644
--- a/webkit/tools/test_shell/simple_file_writer.cc
+++ b/webkit/tools/test_shell/simple_file_writer.cc
@@ -104,7 +104,9 @@ class SimpleFileWriter::IOThreadProxy
proxy_->DidWrite(bytes, complete);
}
- virtual void DidReadMetadata(const base::PlatformFileInfo&) {
+ virtual void DidReadMetadata(
+ const base::PlatformFileInfo&,
+ const FilePath&) {
NOTREACHED();
}
@@ -114,8 +116,9 @@ class SimpleFileWriter::IOThreadProxy
NOTREACHED();
}
- virtual void DidOpenFileSystem(const std::string& name,
- const FilePath& root_path) {
+ virtual void DidOpenFileSystem(
+ const std::string& name,
+ const FilePath& root_path) {
NOTREACHED();
}