summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authordumi@chromium.org <dumi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-09-22 03:29:14 +0000
committerdumi@chromium.org <dumi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-09-22 03:29:14 +0000
commit5746640f419fe2b493ed4e97aa473e96f73c8d73 (patch)
tree63b222962eb9c5ea5d230d8add24fe72e6281386 /chrome
parentae236193f7b64659caf81ba2a009f8ff4e947693 (diff)
downloadchromium_src-5746640f419fe2b493ed4e97aa473e96f73c8d73.zip
chromium_src-5746640f419fe2b493ed4e97aa473e96f73c8d73.tar.gz
chromium_src-5746640f419fe2b493ed4e97aa473e96f73c8d73.tar.bz2
Refactor some file_system classes to use chromium types instead of
WebKit API types. BUG=none TEST=none Review URL: http://codereview.chromium.org/3406008 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@60152 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/file_system/browser_file_system_callback_dispatcher.cc45
-rw-r--r--chrome/browser/file_system/browser_file_system_callback_dispatcher.h33
-rw-r--r--chrome/browser/file_system/chrome_file_system_operation.cc14
-rw-r--r--chrome/browser/file_system/chrome_file_system_operation.h28
-rw-r--r--chrome/browser/file_system/chrome_file_system_operation_unittest.cc571
-rw-r--r--chrome/browser/file_system/file_system_dispatcher_host.cc76
-rw-r--r--chrome/browser/file_system/file_system_dispatcher_host.h28
-rw-r--r--chrome/chrome_browser.gypi4
-rw-r--r--chrome/chrome_tests.gypi1
-rw-r--r--chrome/common/file_system/file_system_dispatcher.cc177
-rw-r--r--chrome/common/file_system/file_system_dispatcher.h70
-rw-r--r--chrome/common/file_system/webfilesystem_impl.cc133
-rw-r--r--chrome/common/render_messages.h1
-rw-r--r--chrome/common/render_messages_internal.h20
-rw-r--r--chrome/common/render_messages_params.cc40
-rw-r--r--chrome/common/render_messages_params.h22
16 files changed, 348 insertions, 915 deletions
diff --git a/chrome/browser/file_system/browser_file_system_callback_dispatcher.cc b/chrome/browser/file_system/browser_file_system_callback_dispatcher.cc
new file mode 100644
index 0000000..107515e
--- /dev/null
+++ b/chrome/browser/file_system/browser_file_system_callback_dispatcher.cc
@@ -0,0 +1,45 @@
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/file_system/browser_file_system_callback_dispatcher.h"
+
+#include "chrome/browser/file_system/file_system_dispatcher_host.h"
+
+BrowserFileSystemCallbackDispatcher::BrowserFileSystemCallbackDispatcher(
+ FileSystemDispatcherHost* dispatcher_host, int request_id)
+ : dispatcher_host_(dispatcher_host),
+ request_id_(request_id) {
+ DCHECK(dispatcher_host_);
+}
+
+void BrowserFileSystemCallbackDispatcher::DidSucceed() {
+ dispatcher_host_->Send(new ViewMsg_FileSystem_DidSucceed(request_id_));
+ dispatcher_host_->RemoveCompletedOperation(request_id_);
+}
+
+void BrowserFileSystemCallbackDispatcher::DidReadMetadata(
+ const base::PlatformFileInfo& info) {
+ dispatcher_host_->Send(new ViewMsg_FileSystem_DidReadMetadata(
+ request_id_, info));
+ dispatcher_host_->RemoveCompletedOperation(request_id_);
+}
+
+void BrowserFileSystemCallbackDispatcher::DidReadDirectory(
+ const std::vector<base::file_util_proxy::Entry>& entries, bool has_more) {
+ dispatcher_host_->Send(new ViewMsg_FileSystem_DidReadDirectory(
+ request_id_, entries, has_more));
+ dispatcher_host_->RemoveCompletedOperation(request_id_);
+}
+
+void BrowserFileSystemCallbackDispatcher::DidOpenFileSystem(
+ const string16&, const FilePath&) {
+ NOTREACHED();
+}
+
+void BrowserFileSystemCallbackDispatcher::DidFail(
+ base::PlatformFileError error_code) {
+ dispatcher_host_->Send(new ViewMsg_FileSystem_DidFail(
+ request_id_, error_code));
+ dispatcher_host_->RemoveCompletedOperation(request_id_);
+}
diff --git a/chrome/browser/file_system/browser_file_system_callback_dispatcher.h b/chrome/browser/file_system/browser_file_system_callback_dispatcher.h
new file mode 100644
index 0000000..0372e09
--- /dev/null
+++ b/chrome/browser/file_system/browser_file_system_callback_dispatcher.h
@@ -0,0 +1,33 @@
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_FILE_SYSTEM_BROWSER_FILE_SYSTEM_CALLBACK_DISPATCHER_H_
+#define CHROME_BROWSER_FILE_SYSTEM_BROWSER_FILE_SYSTEM_CALLBACK_DISPATCHER_H_
+
+#include "webkit/fileapi/file_system_callback_dispatcher.h"
+
+class FileSystemDispatcherHost;
+
+class BrowserFileSystemCallbackDispatcher
+ : public fileapi::FileSystemCallbackDispatcher {
+ public:
+ BrowserFileSystemCallbackDispatcher(FileSystemDispatcherHost* dispatcher_host,
+ int request_id);
+
+ // FileSystemCallbackDispatcher implementation.
+ virtual void DidSucceed();
+ virtual void DidReadMetadata(const base::PlatformFileInfo& file_info);
+ virtual void DidReadDirectory(
+ const std::vector<base::file_util_proxy::Entry>& entries,
+ bool has_more);
+ virtual void DidOpenFileSystem(const string16& name,
+ const FilePath& root_path);
+ virtual void DidFail(base::PlatformFileError error_code);
+
+ private:
+ scoped_refptr<FileSystemDispatcherHost> dispatcher_host_;
+ int request_id_;
+};
+
+#endif // CHROME_BROWSER_FILE_SYSTEM_BROWSER_FILE_SYSTEM_CALLBACK_DISPATCHER_H_
diff --git a/chrome/browser/file_system/chrome_file_system_operation.cc b/chrome/browser/file_system/chrome_file_system_operation.cc
deleted file mode 100644
index 020aa3e..0000000
--- a/chrome/browser/file_system/chrome_file_system_operation.cc
+++ /dev/null
@@ -1,14 +0,0 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "chrome/browser/file_system/chrome_file_system_operation.h"
-
-#include "chrome/browser/chrome_thread.h"
-
-ChromeFileSystemOperation::ChromeFileSystemOperation(
- int request_id, fileapi::FileSystemOperationClient* client)
- : fileapi::FileSystemOperation(client,
- ChromeThread::GetMessageLoopProxyForThread(ChromeThread::FILE)),
- request_id_(request_id) { }
-
diff --git a/chrome/browser/file_system/chrome_file_system_operation.h b/chrome/browser/file_system/chrome_file_system_operation.h
deleted file mode 100644
index 3b1d3ca..0000000
--- a/chrome/browser/file_system/chrome_file_system_operation.h
+++ /dev/null
@@ -1,28 +0,0 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef CHROME_BROWSER_FILE_SYSTEM_CHROME_FILE_SYSTEM_OPERATION_H_
-#define CHROME_BROWSER_FILE_SYSTEM_CHROME_FILE_SYSTEM_OPERATION_H_
-
-#include "webkit/fileapi/file_system_operation.h"
-
-// This class is designed to serve one-time file system operation per instance.
-// Only one method(CreateFile, CreateDirectory, Copy, Move, DirectoryExists,
-// GetMetadata, ReadDirectory and Remove) may be called during the lifetime of
-// this object and it should be called no more than once.
-class ChromeFileSystemOperation : public fileapi::FileSystemOperation {
- public:
- ChromeFileSystemOperation(
- int request_id, fileapi::FileSystemOperationClient* client);
-
- int request_id() const { return request_id_; }
-
- private:
- int request_id_;
-
- DISALLOW_COPY_AND_ASSIGN(ChromeFileSystemOperation);
-};
-
-#endif // CHROME_BROWSER_FILE_SYSTEM_CHROME_FILE_SYSTEM_OPERATION_H_
-
diff --git a/chrome/browser/file_system/chrome_file_system_operation_unittest.cc b/chrome/browser/file_system/chrome_file_system_operation_unittest.cc
deleted file mode 100644
index 57ca164..0000000
--- a/chrome/browser/file_system/chrome_file_system_operation_unittest.cc
+++ /dev/null
@@ -1,571 +0,0 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "chrome/browser/file_system/chrome_file_system_operation.h"
-
-#include "base/logging.h"
-#include "base/rand_util.h"
-#include "base/scoped_ptr.h"
-#include "base/scoped_temp_dir.h"
-#include "chrome/browser/chrome_thread.h"
-#include "testing/gtest/include/gtest/gtest.h"
-#include "third_party/WebKit/WebKit/chromium/public/WebFileError.h"
-#include "webkit/fileapi/file_system_operation_client.h"
-
-namespace {
-int kInvalidRequestId = -1;
-int kFileOperationStatusNotSet = 0;
-int kFileOperationSucceeded = 1;
-}
-
-using fileapi::FileSystemOperation;
-
-bool FileExists(FilePath path) {
- return file_util::PathExists(path) && !file_util::DirectoryExists(path);
-}
-
-class MockClient: public fileapi::FileSystemOperationClient {
- public:
- MockClient()
- : status_(kFileOperationStatusNotSet),
- request_id_(kInvalidRequestId) {
- }
-
- ~MockClient() {}
-
- virtual void DidFail(WebKit::WebFileError status,
- FileSystemOperation* operation) {
- status_ = status;
- request_id_ =
- static_cast<ChromeFileSystemOperation*>(operation)->request_id();
- }
-
- virtual void DidSucceed(FileSystemOperation* operation) {
- status_ = kFileOperationSucceeded;
- request_id_ =
- static_cast<ChromeFileSystemOperation*>(operation)->request_id();
- }
-
- virtual void DidReadMetadata(
- const base::PlatformFileInfo& info,
- FileSystemOperation* operation) {
- info_ = info;
- request_id_ =
- static_cast<ChromeFileSystemOperation*>(operation)->request_id();
- }
-
- virtual void DidReadDirectory(
- const std::vector<base::file_util_proxy::Entry>& entries,
- bool has_more,
- FileSystemOperation* operation) {
- entries_ = entries;
- request_id_ =
- static_cast<ChromeFileSystemOperation*>(operation)->request_id();
- }
-
- // Helpers for testing.
- int status() const { return status_; }
- int request_id() const { return request_id_; }
- const base::PlatformFileInfo& info() const { return info_; }
- const std::vector<base::file_util_proxy::Entry>& entries() const {
- return entries_;
- }
-
- private:
- int status_;
- int request_id_;
- base::PlatformFileInfo info_;
- std::vector<base::file_util_proxy::Entry> entries_;
-};
-
-class ChromeFileSystemOperationTest : public testing::Test {
- public:
- ChromeFileSystemOperationTest()
- : ui_thread_(ChromeThread::UI, &loop_),
- file_thread_(ChromeThread::FILE, &loop_) {
- base_.CreateUniqueTempDir();
- }
-
- protected:
- virtual void SetUp() {
- mock_client_.reset(new MockClient());
- current_request_id_ = kInvalidRequestId;
- ASSERT_TRUE(base_.IsValid());
- }
-
- // Returns a new operation pointer that is created each time it's called.
- // The pointer is owned by the test class.
- ChromeFileSystemOperation* operation() {
- current_request_id_ = base::RandInt(0, kint32max);
- operation_.reset(new ChromeFileSystemOperation(
- current_request_id_, mock_client_.get()));
- return operation_.get();
- }
-
- scoped_ptr<MockClient> mock_client_;
- int current_request_id_;
-
- MessageLoop loop_;
- ChromeThread ui_thread_;
- ChromeThread file_thread_;
-
- // Common temp base for all non-existing file/dir path test cases.
- // This is in case a dir on test machine exists. It's better to
- // create temp and then create non-existing file paths under it.
- ScopedTempDir base_;
-
- private:
- scoped_ptr<ChromeFileSystemOperation> operation_;
-
- DISALLOW_COPY_AND_ASSIGN(ChromeFileSystemOperationTest);
-};
-
-TEST_F(ChromeFileSystemOperationTest, TestMoveFailureSrcDoesntExist) {
- FilePath src(base_.path().Append(FILE_PATH_LITERAL("a")));
- FilePath dest(base_.path().Append(FILE_PATH_LITERAL("b")));
- operation()->Move(src, dest);
- loop_.RunAllPending();
- EXPECT_EQ(WebKit::WebFileErrorNotFound, mock_client_->status());
- EXPECT_EQ(current_request_id_, mock_client_->request_id());
-}
-
-
-TEST_F(ChromeFileSystemOperationTest, TestMoveFailureContainsPath) {
- FilePath file_under_base = base_.path().Append(FILE_PATH_LITERAL("b"));
- operation()->Move(base_.path(), file_under_base);
- loop_.RunAllPending();
- EXPECT_EQ(WebKit::WebFileErrorInvalidModification, mock_client_->status());
- EXPECT_EQ(current_request_id_, mock_client_->request_id());
-}
-
-TEST_F(ChromeFileSystemOperationTest, TestMoveFailureSrcDirExistsDestFile) {
- // Src exists and is dir. Dest is a file.
- ScopedTempDir dest_dir;
- ASSERT_TRUE(dest_dir.CreateUniqueTempDir());
- FilePath dest_file;
- file_util::CreateTemporaryFileInDir(dest_dir.path(), &dest_file);
-
- operation()->Move(base_.path(), dest_file);
- loop_.RunAllPending();
- EXPECT_EQ(mock_client_->status(), WebKit::WebFileErrorInvalidModification);
- EXPECT_EQ(current_request_id_, mock_client_->request_id());
-}
-
-TEST_F(ChromeFileSystemOperationTest, TestMoveFailureDestParentDoesntExist) {
- // Dest. parent path does not exist.
- ScopedTempDir src_dir;
- ASSERT_TRUE(src_dir.CreateUniqueTempDir());
- FilePath nonexisting(base_.path().Append(FILE_PATH_LITERAL("DontExistDir")));
- FilePath nonexisting_file = nonexisting.Append(
- FILE_PATH_LITERAL("DontExistFile"));
-
- operation()->Move(src_dir.path(), nonexisting_file);
- loop_.RunAllPending();
- EXPECT_EQ(mock_client_->status(), WebKit::WebFileErrorNotFound);
- EXPECT_EQ(current_request_id_, mock_client_->request_id());
-}
-
-TEST_F(ChromeFileSystemOperationTest, TestMoveSuccessSrcFileAndOverwrite) {
- ScopedTempDir src_dir;
- ASSERT_TRUE(src_dir.CreateUniqueTempDir());
- FilePath src_file;
- file_util::CreateTemporaryFileInDir(src_dir.path(), &src_file);
-
- ScopedTempDir dest_dir;
- ASSERT_TRUE(dest_dir.CreateUniqueTempDir());
- FilePath dest_file;
- file_util::CreateTemporaryFileInDir(dest_dir.path(), &dest_file);
-
- operation()->Move(src_file, dest_file);
- loop_.RunAllPending();
- EXPECT_EQ(kFileOperationSucceeded, mock_client_->status());
- EXPECT_TRUE(FileExists(dest_file));
- EXPECT_EQ(current_request_id_, mock_client_->request_id());
-}
-
-TEST_F(ChromeFileSystemOperationTest, TestMoveSuccessSrcFileAndNew) {
- ScopedTempDir src_dir;
- ASSERT_TRUE(src_dir.CreateUniqueTempDir());
- FilePath src_file;
- file_util::CreateTemporaryFileInDir(src_dir.path(), &src_file);
-
- ScopedTempDir dest_dir;
- ASSERT_TRUE(dest_dir.CreateUniqueTempDir());
- FilePath dest_file(dest_dir.path().Append(FILE_PATH_LITERAL("NewFile")));
-
- operation()->Move(src_file, dest_file);
- loop_.RunAllPending();
- EXPECT_EQ(kFileOperationSucceeded, mock_client_->status());
- EXPECT_TRUE(FileExists(dest_file));
- EXPECT_EQ(current_request_id_, mock_client_->request_id());
-}
-
-TEST_F(ChromeFileSystemOperationTest, TestCopyFailureSrcDoesntExist) {
- FilePath src(base_.path().Append(FILE_PATH_LITERAL("a")));
- FilePath dest(base_.path().Append(FILE_PATH_LITERAL("b")));
- operation()->Copy(src, dest);
- loop_.RunAllPending();
- EXPECT_EQ(WebKit::WebFileErrorNotFound, mock_client_->status());
- EXPECT_EQ(current_request_id_, mock_client_->request_id());
-}
-
-TEST_F(ChromeFileSystemOperationTest, TestCopyFailureContainsPath) {
- FilePath file_under_base = base_.path().Append(FILE_PATH_LITERAL("b"));
- operation()->Copy(base_.path(), file_under_base);
- loop_.RunAllPending();
- EXPECT_EQ(WebKit::WebFileErrorInvalidModification, mock_client_->status());
- EXPECT_EQ(current_request_id_, mock_client_->request_id());
-}
-
-TEST_F(ChromeFileSystemOperationTest, TestCopyFailureSrcDirExistsDestFile) {
- // Src exists and is dir. Dest is a file.
- ScopedTempDir dir;
- ASSERT_TRUE(dir.CreateUniqueTempDir());
- FilePath dest_file;
- file_util::CreateTemporaryFileInDir(dir.path(), &dest_file);
-
- operation()->Copy(base_.path(), dest_file);
- loop_.RunAllPending();
- EXPECT_EQ(mock_client_->status(), WebKit::WebFileErrorInvalidModification);
- EXPECT_EQ(current_request_id_, mock_client_->request_id());
-}
-
-TEST_F(ChromeFileSystemOperationTest, TestCopyFailureDestParentDoesntExist) {
- // Dest. parent path does not exist.
- ScopedTempDir dir;
- ASSERT_TRUE(dir.CreateUniqueTempDir());
- FilePath src_dir = dir.path();
-
- FilePath nonexisting(base_.path().Append(FILE_PATH_LITERAL("DontExistDir")));
- file_util::EnsureEndsWithSeparator(&nonexisting);
- FilePath nonexisting_file = nonexisting.Append(
- FILE_PATH_LITERAL("DontExistFile"));
-
- operation()->Copy(src_dir, nonexisting_file);
- loop_.RunAllPending();
- EXPECT_EQ(mock_client_->status(), WebKit::WebFileErrorNotFound);
- EXPECT_EQ(current_request_id_, mock_client_->request_id());
-}
-
-TEST_F(ChromeFileSystemOperationTest, TestCopySuccessSrcFileAndOverwrite) {
- ScopedTempDir src_dir;
- ASSERT_TRUE(src_dir.CreateUniqueTempDir());
- FilePath src_file;
- file_util::CreateTemporaryFileInDir(src_dir.path(), &src_file);
-
- ScopedTempDir dest_dir;
- ASSERT_TRUE(dest_dir.CreateUniqueTempDir());
- FilePath dest_file;
- file_util::CreateTemporaryFileInDir(dest_dir.path(), &dest_file);
-
- operation()->Copy(src_file, dest_file);
- loop_.RunAllPending();
- EXPECT_EQ(kFileOperationSucceeded, mock_client_->status());
- EXPECT_TRUE(FileExists(dest_file));
- EXPECT_EQ(current_request_id_, mock_client_->request_id());
-}
-
-TEST_F(ChromeFileSystemOperationTest, TestCopySuccessSrcFileAndNew) {
- ScopedTempDir src_dir;
- ASSERT_TRUE(src_dir.CreateUniqueTempDir());
- FilePath src_file;
- file_util::CreateTemporaryFileInDir(src_dir.path(), &src_file);
-
- ScopedTempDir dest_dir;
- ASSERT_TRUE(dest_dir.CreateUniqueTempDir());
- FilePath dest_file(dest_dir.path().Append(FILE_PATH_LITERAL("NewFile")));
-
- operation()->Copy(src_file, dest_file);
- loop_.RunAllPending();
- EXPECT_EQ(kFileOperationSucceeded, mock_client_->status());
- EXPECT_TRUE(FileExists(dest_file));
- EXPECT_EQ(current_request_id_, mock_client_->request_id());
-}
-
-TEST_F(ChromeFileSystemOperationTest, TestCopySuccessSrcDir) {
- ScopedTempDir src_dir;
- ASSERT_TRUE(src_dir.CreateUniqueTempDir());
-
- ScopedTempDir dest_dir;
- ASSERT_TRUE(dest_dir.CreateUniqueTempDir());
-
- operation()->Copy(src_dir.path(), dest_dir.path());
- loop_.RunAllPending();
- EXPECT_EQ(kFileOperationSucceeded, mock_client_->status());
- EXPECT_EQ(current_request_id_, mock_client_->request_id());
-}
-
-TEST_F(ChromeFileSystemOperationTest, TestCopyDestParentExistsSuccess) {
- ScopedTempDir src_dir;
- ASSERT_TRUE(src_dir.CreateUniqueTempDir());
- FilePath src_file;
- file_util::CreateTemporaryFileInDir(src_dir.path(), &src_file);
-
- ScopedTempDir dest_dir;
- ASSERT_TRUE(dest_dir.CreateUniqueTempDir());
-
- operation()->Copy(src_file, dest_dir.path());
- loop_.RunAllPending();
- EXPECT_EQ(kFileOperationSucceeded, mock_client_->status());
- EXPECT_EQ(current_request_id_, mock_client_->request_id());
-
- FilePath src_filename(src_file.BaseName());
- EXPECT_TRUE(FileExists(dest_dir.path().Append(src_filename)));
-}
-
-TEST_F(ChromeFileSystemOperationTest, TestCreateFileFailure) {
- // Already existing file and exclusive true.
- ScopedTempDir dir;
- ASSERT_TRUE(dir.CreateUniqueTempDir());
- FilePath file;
-
- file_util::CreateTemporaryFileInDir(dir.path(), &file);
- operation()->CreateFile(file, true);
- loop_.RunAllPending();
- EXPECT_EQ(mock_client_->status(), WebKit::WebFileErrorInvalidModification);
- EXPECT_EQ(current_request_id_, mock_client_->request_id());
-}
-
-TEST_F(ChromeFileSystemOperationTest, TestCreateFileSuccessFileExists) {
- // Already existing file and exclusive false.
- ScopedTempDir dir;
- ASSERT_TRUE(dir.CreateUniqueTempDir());
- FilePath file;
- file_util::CreateTemporaryFileInDir(dir.path(), &file);
-
- operation()->CreateFile(file, false);
- loop_.RunAllPending();
- EXPECT_EQ(kFileOperationSucceeded, mock_client_->status());
- EXPECT_TRUE(FileExists(file));
- EXPECT_EQ(current_request_id_, mock_client_->request_id());
-}
-
-TEST_F(ChromeFileSystemOperationTest, TestCreateFileSuccessExclusive) {
- // File doesn't exist but exclusive is true.
- ScopedTempDir dir;
- ASSERT_TRUE(dir.CreateUniqueTempDir());
- FilePath file = dir.path().Append(FILE_PATH_LITERAL("FileDoesntExist"));
- operation()->CreateFile(file, true);
- loop_.RunAllPending();
- EXPECT_EQ(kFileOperationSucceeded, mock_client_->status());
- EXPECT_TRUE(FileExists(file));
- EXPECT_EQ(current_request_id_, mock_client_->request_id());
-}
-
-TEST_F(ChromeFileSystemOperationTest, TestCreateFileSuccessFileDoesntExist) {
- // Non existing file.
- ScopedTempDir dir;
- ASSERT_TRUE(dir.CreateUniqueTempDir());
- FilePath file = dir.path().Append(FILE_PATH_LITERAL("FileDoesntExist"));
- operation()->CreateFile(file, false);
- loop_.RunAllPending();
- EXPECT_EQ(kFileOperationSucceeded, mock_client_->status());
- EXPECT_EQ(current_request_id_, mock_client_->request_id());
-}
-
-TEST_F(ChromeFileSystemOperationTest,
- TestCreateDirFailureDestParentDoesntExist) {
- // Dest. parent path does not exist.
- FilePath nonexisting(base_.path().Append(
- FILE_PATH_LITERAL("DirDoesntExist")));
- file_util::EnsureEndsWithSeparator(&nonexisting);
- FilePath nonexisting_file = nonexisting.Append(
- FILE_PATH_LITERAL("FileDoesntExist"));
- operation()->CreateDirectory(nonexisting_file, false);
- loop_.RunAllPending();
- EXPECT_EQ(WebKit::WebFileErrorNotFound, mock_client_->status());
- EXPECT_EQ(current_request_id_, mock_client_->request_id());
-}
-
-TEST_F(ChromeFileSystemOperationTest, TestCreateDirFailureDirExists) {
- // Exclusive and dir existing at path.
- operation()->CreateDirectory(base_.path(), true);
- loop_.RunAllPending();
- EXPECT_EQ(WebKit::WebFileErrorInvalidModification, mock_client_->status());
- EXPECT_EQ(current_request_id_, mock_client_->request_id());
-}
-
-TEST_F(ChromeFileSystemOperationTest, TestCreateDirFailureFileExists) {
- // Exclusive true and file existing at path.
- ScopedTempDir dir;
- ASSERT_TRUE(dir.CreateUniqueTempDir());
- FilePath file;
- file_util::CreateTemporaryFileInDir(dir.path(), &file);
- operation()->CreateDirectory(file, true);
- loop_.RunAllPending();
- EXPECT_EQ(mock_client_->status(),
- WebKit::WebFileErrorInvalidModification);
- EXPECT_EQ(current_request_id_, mock_client_->request_id());
-}
-
-TEST_F(ChromeFileSystemOperationTest, TestCreateDirSuccess) {
- // Dir exists and exclusive is false.
- ScopedTempDir dir;
- ASSERT_TRUE(dir.CreateUniqueTempDir());
- operation()->CreateDirectory(dir.path(), false);
- loop_.RunAllPending();
- EXPECT_EQ(kFileOperationSucceeded, mock_client_->status());
- EXPECT_EQ(current_request_id_, mock_client_->request_id());
-
- // Dir doesn't exist.
- FilePath nonexisting_dir_path(FILE_PATH_LITERAL("nonexistingdir"));
- operation()->CreateDirectory(nonexisting_dir_path, false);
- loop_.RunAllPending();
- EXPECT_EQ(kFileOperationSucceeded, mock_client_->status());
- EXPECT_TRUE(file_util::DirectoryExists(nonexisting_dir_path));
- EXPECT_EQ(current_request_id_, mock_client_->request_id());
-}
-
-TEST_F(ChromeFileSystemOperationTest, TestCreateDirSuccessExclusive) {
- // Dir doesn't exist.
- ScopedTempDir dir;
- ASSERT_TRUE(dir.CreateUniqueTempDir());
- FilePath nonexisting_dir_path(dir.path().Append(
- FILE_PATH_LITERAL("nonexistingdir")));
-
- operation()->CreateDirectory(nonexisting_dir_path, true);
- loop_.RunAllPending();
- EXPECT_EQ(kFileOperationSucceeded, mock_client_->status());
- EXPECT_TRUE(file_util::DirectoryExists(nonexisting_dir_path));
- EXPECT_EQ(current_request_id_, mock_client_->request_id());
-}
-
-TEST_F(ChromeFileSystemOperationTest, TestExistsAndMetadataFailure) {
- FilePath nonexisting_dir_path(base_.path().Append(
- FILE_PATH_LITERAL("nonexistingdir")));
- operation()->GetMetadata(nonexisting_dir_path);
- loop_.RunAllPending();
- EXPECT_EQ(WebKit::WebFileErrorNotFound, mock_client_->status());
-
- operation()->FileExists(nonexisting_dir_path);
- loop_.RunAllPending();
- EXPECT_EQ(WebKit::WebFileErrorNotFound, mock_client_->status());
- EXPECT_EQ(current_request_id_, mock_client_->request_id());
-
- file_util::EnsureEndsWithSeparator(&nonexisting_dir_path);
- operation()->DirectoryExists(nonexisting_dir_path);
- loop_.RunAllPending();
- EXPECT_EQ(WebKit::WebFileErrorNotFound, mock_client_->status());
- EXPECT_EQ(current_request_id_, mock_client_->request_id());
-}
-
-TEST_F(ChromeFileSystemOperationTest, TestExistsAndMetadataSuccess) {
- ScopedTempDir dir;
- ASSERT_TRUE(dir.CreateUniqueTempDir());
-
- operation()->DirectoryExists(dir.path());
- loop_.RunAllPending();
- EXPECT_EQ(kFileOperationSucceeded, mock_client_->status());
- EXPECT_EQ(current_request_id_, mock_client_->request_id());
-
- operation()->GetMetadata(dir.path());
- loop_.RunAllPending();
- EXPECT_EQ(kFileOperationSucceeded, mock_client_->status());
- EXPECT_TRUE(mock_client_->info().is_directory);
- EXPECT_EQ(current_request_id_, mock_client_->request_id());
-
- FilePath file;
- file_util::CreateTemporaryFileInDir(dir.path(), &file);
- operation()->FileExists(file);
- loop_.RunAllPending();
- EXPECT_EQ(kFileOperationSucceeded, mock_client_->status());
- EXPECT_EQ(current_request_id_, mock_client_->request_id());
-
- operation()->GetMetadata(file);
- loop_.RunAllPending();
- EXPECT_EQ(kFileOperationSucceeded, mock_client_->status());
- EXPECT_FALSE(mock_client_->info().is_directory);
- EXPECT_EQ(current_request_id_, mock_client_->request_id());
-}
-
-TEST_F(ChromeFileSystemOperationTest, TestReadDirFailure) {
- // Path doesn't exists
- FilePath nonexisting_dir_path(base_.path().Append(
- FILE_PATH_LITERAL("NonExistingDir")));
- file_util::EnsureEndsWithSeparator(&nonexisting_dir_path);
- operation()->ReadDirectory(nonexisting_dir_path);
- loop_.RunAllPending();
- EXPECT_EQ(WebKit::WebFileErrorNotFound, mock_client_->status());
- EXPECT_EQ(current_request_id_, mock_client_->request_id());
-
- // File exists.
- ScopedTempDir dir;
- ASSERT_TRUE(dir.CreateUniqueTempDir());
- FilePath file;
- file_util::CreateTemporaryFileInDir(dir.path(), &file);
- operation()->ReadDirectory(file);
- loop_.RunAllPending();
- // TODO(kkanetkar) crbug.com/54309 to change the error code.
- EXPECT_EQ(WebKit::WebFileErrorNotFound, mock_client_->status());
- EXPECT_EQ(current_request_id_, mock_client_->request_id());
-}
-
-TEST_F(ChromeFileSystemOperationTest, TestReadDirSuccess) {
- // parent_dir
- // | |
- // child_dir child_file
- // Verify reading parent_dir.
- ScopedTempDir parent_dir;
- ASSERT_TRUE(parent_dir.CreateUniqueTempDir());
- FilePath child_file;
- file_util::CreateTemporaryFileInDir(parent_dir.path(), &child_file);
- FilePath child_dir;
- ASSERT_TRUE(file_util::CreateTemporaryDirInDir(parent_dir.path(),
- FILE_PATH_LITERAL("child_dir"), &child_dir));
-
- operation()->ReadDirectory(parent_dir.path());
- loop_.RunAllPending();
- EXPECT_EQ(kFileOperationStatusNotSet, mock_client_->status());
- EXPECT_EQ(2u, mock_client_->entries().size());
- EXPECT_EQ(current_request_id_, mock_client_->request_id());
-
- for (size_t i = 0; i < mock_client_->entries().size(); ++i) {
- if (mock_client_->entries()[i].is_directory)
- EXPECT_EQ(child_dir.BaseName().value(), mock_client_->entries()[i].name);
- else
- EXPECT_EQ(child_file.BaseName().value(), mock_client_->entries()[i].name);
- }
-}
-
-TEST_F(ChromeFileSystemOperationTest, TestRemoveFailure) {
- // Path doesn't exist.
- FilePath nonexisting(base_.path().Append(
- FILE_PATH_LITERAL("NonExistingDir")));
- file_util::EnsureEndsWithSeparator(&nonexisting);
-
- operation()->Remove(nonexisting);
- loop_.RunAllPending();
- EXPECT_EQ(WebKit::WebFileErrorNotFound, mock_client_->status());
- EXPECT_EQ(current_request_id_, mock_client_->request_id());
-
- // By spec recursive is always false. Non-empty dir should fail.
- // parent_dir
- // | |
- // child_dir child_file
- // Verify deleting parent_dir.
- ScopedTempDir parent_dir;
- ASSERT_TRUE(parent_dir.CreateUniqueTempDir());
- FilePath child_file;
- file_util::CreateTemporaryFileInDir(parent_dir.path(), &child_file);
- FilePath child_dir;
- ASSERT_TRUE(file_util::CreateTemporaryDirInDir(parent_dir.path(),
- FILE_PATH_LITERAL("child_dir"), &child_dir));
-
- operation()->Remove(parent_dir.path());
- loop_.RunAllPending();
- EXPECT_EQ(WebKit::WebFileErrorInvalidModification, mock_client_->status());
- EXPECT_EQ(current_request_id_, mock_client_->request_id());
-}
-
-TEST_F(ChromeFileSystemOperationTest, TestRemoveSuccess) {
- ScopedTempDir empty_dir;
- ASSERT_TRUE(empty_dir.CreateUniqueTempDir());
- EXPECT_TRUE(file_util::DirectoryExists(empty_dir.path()));
-
- operation()->Remove(empty_dir.path());
- loop_.RunAllPending();
- EXPECT_EQ(kFileOperationSucceeded, mock_client_->status());
- EXPECT_FALSE(file_util::DirectoryExists(empty_dir.path()));
- EXPECT_EQ(current_request_id_, mock_client_->request_id());
-}
diff --git a/chrome/browser/file_system/file_system_dispatcher_host.cc b/chrome/browser/file_system/file_system_dispatcher_host.cc
index 86555a2..385f2a4 100644
--- a/chrome/browser/file_system/file_system_dispatcher_host.cc
+++ b/chrome/browser/file_system/file_system_dispatcher_host.cc
@@ -10,13 +10,13 @@
#include "base/utf_string_conversions.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/chrome_thread.h"
+#include "chrome/browser/file_system/browser_file_system_callback_dispatcher.h"
#include "chrome/browser/file_system/file_system_host_context.h"
#include "chrome/browser/host_content_settings_map.h"
#include "chrome/browser/renderer_host/browser_render_process_host.h"
#include "chrome/common/render_messages.h"
#include "chrome/common/render_messages_params.h"
#include "googleurl/src/gurl.h"
-#include "third_party/WebKit/WebKit/chromium/public/WebFileError.h"
#include "webkit/glue/webkit_glue.h"
// A class to hold an ongoing openFileSystem completion task.
@@ -85,6 +85,9 @@ FileSystemDispatcherHost::FileSystemDispatcherHost(
DCHECK(message_sender_);
}
+FileSystemDispatcherHost::~FileSystemDispatcherHost() {
+}
+
void FileSystemDispatcherHost::Init(base::ProcessHandle process_handle) {
DCHECK(ChromeThread::CurrentlyOn(ChromeThread::IO));
DCHECK(!shutdown_);
@@ -96,12 +99,6 @@ void FileSystemDispatcherHost::Init(base::ProcessHandle process_handle) {
void FileSystemDispatcherHost::Shutdown() {
message_sender_ = NULL;
shutdown_ = true;
-
- // Drop all the operations.
- for (OperationsMap::const_iterator iter(&operations_);
- !iter.IsAtEnd(); iter.Advance()) {
- operations_.Remove(iter.GetCurrentKey());
- }
}
bool FileSystemDispatcherHost::OnMessageReceived(
@@ -182,11 +179,12 @@ void FileSystemDispatcherHost::OnReadMetadata(
}
void FileSystemDispatcherHost::OnCreate(
- int request_id, const FilePath& path, bool exclusive, bool is_directory) {
+ int request_id, const FilePath& path, bool exclusive,
+ bool is_directory, bool recursive) {
if (!CheckValidFileSystemPath(path, request_id))
return;
if (is_directory)
- GetNewOperation(request_id)->CreateDirectory(path, exclusive);
+ GetNewOperation(request_id)->CreateDirectory(path, exclusive, recursive);
else
GetNewOperation(request_id)->CreateFile(path, exclusive);
}
@@ -208,46 +206,6 @@ void FileSystemDispatcherHost::OnReadDirectory(
GetNewOperation(request_id)->ReadDirectory(path);
}
-void FileSystemDispatcherHost::DidFail(
- WebKit::WebFileError status,
- fileapi::FileSystemOperation* operation) {
- int request_id =
- static_cast<ChromeFileSystemOperation*>(operation)->request_id();
- Send(new ViewMsg_FileSystem_DidFail(request_id, status));
- operations_.Remove(request_id);
-}
-
-void FileSystemDispatcherHost::DidSucceed(
- fileapi::FileSystemOperation* operation) {
- int request_id =
- static_cast<ChromeFileSystemOperation*>(operation)->request_id();
- Send(new ViewMsg_FileSystem_DidSucceed(request_id));
- operations_.Remove(request_id);
-}
-
-void FileSystemDispatcherHost::DidReadMetadata(
- const base::PlatformFileInfo& info,
- fileapi::FileSystemOperation* operation) {
- int request_id =
- static_cast<ChromeFileSystemOperation*>(operation)->request_id();
- Send(new ViewMsg_FileSystem_DidReadMetadata(request_id, info));
- operations_.Remove(request_id);
-}
-
-void FileSystemDispatcherHost::DidReadDirectory(
- const std::vector<base::file_util_proxy::Entry>& entries,
- bool has_more,
- fileapi::FileSystemOperation* operation) {
- int request_id =
- static_cast<ChromeFileSystemOperation*>(operation)->request_id();
- ViewMsg_FileSystem_DidReadDirectory_Params params;
- params.request_id = request_id;
- params.entries = entries;
- params.has_more = has_more;
- Send(new ViewMsg_FileSystem_DidReadDirectory(params));
- operations_.Remove(request_id);
-}
-
void FileSystemDispatcherHost::Send(IPC::Message* message) {
DCHECK(ChromeThread::CurrentlyOn(ChromeThread::IO));
if (!shutdown_ && message_sender_)
@@ -262,16 +220,24 @@ bool FileSystemDispatcherHost::CheckValidFileSystemPath(
// |path| is under the valid FileSystem root path for this host context.
if (!context_->CheckValidFileSystemPath(path)) {
Send(new ViewMsg_FileSystem_DidFail(
- request_id, WebKit::WebFileErrorSecurity));
+ request_id, base::PLATFORM_FILE_ERROR_SECURITY));
return false;
}
return true;
}
-ChromeFileSystemOperation* FileSystemDispatcherHost::GetNewOperation(
+fileapi::FileSystemOperation* FileSystemDispatcherHost::GetNewOperation(
int request_id) {
- scoped_ptr<ChromeFileSystemOperation> operation(
- new ChromeFileSystemOperation(request_id, this));
- operations_.AddWithID(operation.get(), request_id);
- return operation.release();
+ BrowserFileSystemCallbackDispatcher* dispatcher =
+ new BrowserFileSystemCallbackDispatcher(this, request_id);
+ fileapi::FileSystemOperation* operation = new fileapi::FileSystemOperation(
+ dispatcher,
+ ChromeThread::GetMessageLoopProxyForThread(ChromeThread::FILE));
+ operations_.AddWithID(operation, request_id);
+ return operation;
+}
+
+void FileSystemDispatcherHost::RemoveCompletedOperation(int request_id) {
+ DCHECK(operations_.Lookup(request_id));
+ operations_.Remove(request_id);
}
diff --git a/chrome/browser/file_system/file_system_dispatcher_host.h b/chrome/browser/file_system/file_system_dispatcher_host.h
index 8f21654..ac22255 100644
--- a/chrome/browser/file_system/file_system_dispatcher_host.h
+++ b/chrome/browser/file_system/file_system_dispatcher_host.h
@@ -13,9 +13,8 @@
#include "base/platform_file.h"
#include "base/scoped_callback_factory.h"
#include "base/ref_counted.h"
-#include "chrome/browser/file_system/chrome_file_system_operation.h"
#include "chrome/common/render_messages.h"
-#include "webkit/fileapi/file_system_operation_client.h"
+#include "webkit/fileapi/file_system_operation.h"
class FileSystemHostContext;
class HostContentSettingsMap;
@@ -23,12 +22,12 @@ class Receiver;
class ResourceMessageFilter;
class FileSystemDispatcherHost
- : public base::RefCountedThreadSafe<FileSystemDispatcherHost>,
- public fileapi::FileSystemOperationClient {
+ : public base::RefCountedThreadSafe<FileSystemDispatcherHost> {
public:
FileSystemDispatcherHost(IPC::Message::Sender* sender,
FileSystemHostContext* file_system_host_context,
HostContentSettingsMap* host_content_settings_map);
+ ~FileSystemDispatcherHost();
void Init(base::ProcessHandle process_handle);
void Shutdown();
@@ -46,25 +45,16 @@ class FileSystemDispatcherHost
void OnCreate(int request_id,
const FilePath& path,
bool exclusive,
- bool is_directory);
+ bool is_directory,
+ bool recursive);
void OnExists(int request_id, const FilePath& path, bool is_directory);
void OnReadDirectory(int request_id, const FilePath& path);
void Send(IPC::Message* message);
-
- // FileSystemOperationClient methods.
- virtual void DidFail(WebKit::WebFileError status,
- fileapi::FileSystemOperation* operation);
- virtual void DidSucceed(fileapi::FileSystemOperation* operation);
- virtual void DidReadMetadata(
- const base::PlatformFileInfo& info,
- fileapi::FileSystemOperation* operation);
- virtual void DidReadDirectory(
- const std::vector<base::file_util_proxy::Entry>& entries,
- bool has_more, fileapi::FileSystemOperation* operation);
+ void RemoveCompletedOperation(int request_id);
private:
- // Creates a new ChromeFileSystemOperation.
- ChromeFileSystemOperation* GetNewOperation(int request_id);
+ // Creates a new FileSystemOperation.
+ fileapi::FileSystemOperation* GetNewOperation(int request_id);
// Checks the validity of a given |path|. Returns true if the given |path|
// is valid as a path for FileSystem API. Otherwise it sends back a
@@ -85,7 +75,7 @@ class FileSystemDispatcherHost
scoped_refptr<HostContentSettingsMap> host_content_settings_map_;
// Keeps ongoing file system operations.
- typedef IDMap<ChromeFileSystemOperation, IDMapOwnPointer> OperationsMap;
+ typedef IDMap<fileapi::FileSystemOperation, IDMapOwnPointer> OperationsMap;
OperationsMap operations_;
DISALLOW_COPY_AND_ASSIGN(FileSystemDispatcherHost);
diff --git a/chrome/chrome_browser.gypi b/chrome/chrome_browser.gypi
index 839dc87..ca6dd5d 100644
--- a/chrome/chrome_browser.gypi
+++ b/chrome/chrome_browser.gypi
@@ -1527,8 +1527,8 @@
'browser/file_path_watcher_win.cc',
'browser/file_select_helper.cc',
'browser/file_select_helper.h',
- 'browser/file_system/chrome_file_system_operation.cc',
- 'browser/file_system/chrome_file_system_operation.h',
+ 'browser/file_system/browser_file_system_callback_dispatcher.cc',
+ 'browser/file_system/browser_file_system_callback_dispatcher.h',
'browser/file_system/file_system_dispatcher_host.cc',
'browser/file_system/file_system_dispatcher_host.h',
'browser/file_system/file_system_host_context.cc',
diff --git a/chrome/chrome_tests.gypi b/chrome/chrome_tests.gypi
index 9bbe65a..28862b9 100644
--- a/chrome/chrome_tests.gypi
+++ b/chrome/chrome_tests.gypi
@@ -1069,7 +1069,6 @@
'browser/extensions/user_script_listener_unittest.cc',
'browser/extensions/user_script_master_unittest.cc',
'browser/file_path_watcher_unittest.cc',
- 'browser/file_system/chrome_file_system_operation_unittest.cc',
'browser/file_system/file_system_host_context_unittest.cc',
'browser/find_backend_unittest.cc',
'browser/first_run/first_run_unittest.cc',
diff --git a/chrome/common/file_system/file_system_dispatcher.cc b/chrome/common/file_system/file_system_dispatcher.cc
index 89a2de4..8ae0c16 100644
--- a/chrome/common/file_system/file_system_dispatcher.cc
+++ b/chrome/common/file_system/file_system_dispatcher.cc
@@ -8,31 +8,20 @@
#include "chrome/common/child_thread.h"
#include "chrome/common/render_messages.h"
#include "chrome/common/render_messages_params.h"
-#include "third_party/WebKit/WebKit/chromium/public/WebFileInfo.h"
-#include "third_party/WebKit/WebKit/chromium/public/WebFileSystemEntry.h"
-#include "third_party/WebKit/WebKit/chromium/public/WebFileSystemCallbacks.h"
-#include "third_party/WebKit/WebKit/chromium/public/WebVector.h"
#include "webkit/glue/webkit_glue.h"
-using WebKit::WebFileError;
-using WebKit::WebFileInfo;
-using WebKit::WebFileSystemCallbacks;
-using WebKit::WebFileSystemEntry;
-using WebKit::WebVector;
-
FileSystemDispatcher::FileSystemDispatcher() {
}
FileSystemDispatcher::~FileSystemDispatcher() {
// Make sure we fire all the remaining callbacks.
- for (IDMap<WebFileSystemCallbacks>::iterator iter(&callbacks_);
- !iter.IsAtEnd();
- iter.Advance()) {
- int callbacks_id = iter.GetCurrentKey();
- WebFileSystemCallbacks* callbacks = iter.GetCurrentValue();
- DCHECK(callbacks);
- callbacks_.Remove(callbacks_id);
- callbacks->didFail(WebKit::WebFileErrorAbort);
+ for (IDMap<fileapi::FileSystemCallbackDispatcher, IDMapOwnPointer>::iterator
+ iter(&dispatchers_); !iter.IsAtEnd(); iter.Advance()) {
+ int request_id = iter.GetCurrentKey();
+ fileapi::FileSystemCallbackDispatcher* dispatcher = iter.GetCurrentValue();
+ DCHECK(dispatcher);
+ dispatcher->DidFail(base::PLATFORM_FILE_ERROR_ABORT);
+ dispatchers_.Remove(request_id);
}
}
@@ -48,103 +37,101 @@ bool FileSystemDispatcher::OnMessageReceived(const IPC::Message& msg) {
return handled;
}
-void FileSystemDispatcher::Move(
- const string16& src_path, const string16& dest_path,
- WebFileSystemCallbacks* callbacks) {
- FilePath src_file_path = webkit_glue::WebStringToFilePath(src_path);
- FilePath dest_file_path = webkit_glue::WebStringToFilePath(dest_path);
- int request_id = callbacks_.Add(callbacks);
- ChildThread::current()->Send(new ViewHostMsg_FileSystem_Move(
- request_id, src_file_path, dest_file_path));
+bool FileSystemDispatcher::Move(
+ const FilePath& src_path,
+ const FilePath& dest_path,
+ fileapi::FileSystemCallbackDispatcher* dispatcher) {
+ int request_id = dispatchers_.Add(dispatcher);
+ return ChildThread::current()->Send(new ViewHostMsg_FileSystem_Move(
+ request_id, src_path, dest_path));
}
-void FileSystemDispatcher::Copy(
- const string16& src_path, const string16& dest_path,
- WebFileSystemCallbacks* callbacks) {
- FilePath src_file_path = webkit_glue::WebStringToFilePath(src_path);
- FilePath dest_file_path = webkit_glue::WebStringToFilePath(dest_path);
- int request_id = callbacks_.Add(callbacks);
- ChildThread::current()->Send(new ViewHostMsg_FileSystem_Copy(
- request_id, src_file_path, dest_file_path));
+bool FileSystemDispatcher::Copy(
+ const FilePath& src_path,
+ const FilePath& dest_path,
+ fileapi::FileSystemCallbackDispatcher* dispatcher) {
+ int request_id = dispatchers_.Add(dispatcher);
+ return ChildThread::current()->Send(new ViewHostMsg_FileSystem_Copy(
+ request_id, src_path, dest_path));
}
-void FileSystemDispatcher::Remove(
- const string16& path, WebFileSystemCallbacks* callbacks) {
- FilePath file_path = webkit_glue::WebStringToFilePath(path);
- int request_id = callbacks_.Add(callbacks);
- ChildThread::current()->Send(
- new ViewHostMsg_FileSystem_Remove(request_id, file_path));
+bool FileSystemDispatcher::Remove(
+ const FilePath& path,
+ fileapi::FileSystemCallbackDispatcher* dispatcher) {
+ int request_id = dispatchers_.Add(dispatcher);
+ return ChildThread::current()->Send(
+ new ViewHostMsg_FileSystem_Remove(request_id, path));
}
-void FileSystemDispatcher::ReadMetadata(
- const string16& path, WebFileSystemCallbacks* callbacks) {
- FilePath file_path = webkit_glue::WebStringToFilePath(path);
- int request_id = callbacks_.Add(callbacks);
- ChildThread::current()->Send(
- new ViewHostMsg_FileSystem_ReadMetadata(request_id, file_path));
+bool FileSystemDispatcher::ReadMetadata(
+ const FilePath& path,
+ fileapi::FileSystemCallbackDispatcher* dispatcher) {
+ int request_id = dispatchers_.Add(dispatcher);
+ return ChildThread::current()->Send(
+ new ViewHostMsg_FileSystem_ReadMetadata(request_id, path));
}
-void FileSystemDispatcher::Create(
- const string16& path, bool exclusive, bool is_directory,
- WebFileSystemCallbacks* callbacks) {
- FilePath file_path = webkit_glue::WebStringToFilePath(path);
- int request_id = callbacks_.Add(callbacks);
- ChildThread::current()->Send(new ViewHostMsg_FileSystem_Create(
- request_id, file_path, exclusive, is_directory));
+bool FileSystemDispatcher::Create(
+ const FilePath& path,
+ bool exclusive,
+ bool is_directory,
+ bool recursive,
+ fileapi::FileSystemCallbackDispatcher* dispatcher) {
+ int request_id = dispatchers_.Add(dispatcher);
+ return ChildThread::current()->Send(new ViewHostMsg_FileSystem_Create(
+ request_id, path, exclusive, is_directory, recursive));
}
-void FileSystemDispatcher::Exists(
- const string16& path, bool is_directory,
- WebFileSystemCallbacks* callbacks) {
- FilePath file_path = webkit_glue::WebStringToFilePath(path);
- int request_id = callbacks_.Add(callbacks);
- ChildThread::current()->Send(
- new ViewHostMsg_FileSystem_Exists(request_id, file_path, is_directory));
+bool FileSystemDispatcher::Exists(
+ const FilePath& path,
+ bool is_directory,
+ fileapi::FileSystemCallbackDispatcher* dispatcher) {
+ int request_id = dispatchers_.Add(dispatcher);
+ return ChildThread::current()->Send(
+ new ViewHostMsg_FileSystem_Exists(request_id, path, is_directory));
}
-void FileSystemDispatcher::ReadDirectory(
- const string16& path, WebFileSystemCallbacks* callbacks) {
- FilePath file_path = webkit_glue::WebStringToFilePath(path);
- int request_id = callbacks_.Add(callbacks);
- ChildThread::current()->Send(
- new ViewHostMsg_FileSystem_ReadDirectory(request_id, file_path));
+bool FileSystemDispatcher::ReadDirectory(
+ const FilePath& path,
+ fileapi::FileSystemCallbackDispatcher* dispatcher) {
+ int request_id = dispatchers_.Add(dispatcher);
+ return ChildThread::current()->Send(
+ new ViewHostMsg_FileSystem_ReadDirectory(request_id, path));
}
void FileSystemDispatcher::DidSucceed(int request_id) {
- WebFileSystemCallbacks* callbacks = callbacks_.Lookup(request_id);
- DCHECK(callbacks);
- callbacks_.Remove(request_id);
- callbacks->didSucceed();
+ fileapi::FileSystemCallbackDispatcher* dispatcher =
+ dispatchers_.Lookup(request_id);
+ DCHECK(dispatcher);
+ dispatcher->DidSucceed();
+ dispatchers_.Remove(request_id);
}
-void FileSystemDispatcher::DidReadMetadata(int request_id,
- const base::PlatformFileInfo& file_info) {
- WebFileSystemCallbacks* callbacks = callbacks_.Lookup(request_id);
- DCHECK(callbacks);
- callbacks_.Remove(request_id);
- WebFileInfo web_file_info;
- web_file_info.modificationTime = file_info.last_modified.ToDoubleT();
- callbacks->didReadMetadata(web_file_info);
+void FileSystemDispatcher::DidReadMetadata(
+ int request_id, const base::PlatformFileInfo& file_info) {
+ fileapi::FileSystemCallbackDispatcher* dispatcher =
+ dispatchers_.Lookup(request_id);
+ DCHECK(dispatcher);
+ dispatcher->DidReadMetadata(file_info);
+ dispatchers_.Remove(request_id);
}
void FileSystemDispatcher::DidReadDirectory(
- const ViewMsg_FileSystem_DidReadDirectory_Params& params) {
- WebFileSystemCallbacks* callbacks = callbacks_.Lookup(params.request_id);
- DCHECK(callbacks);
- if (!params.has_more)
- callbacks_.Remove(params.request_id);
- WebVector<WebFileSystemEntry> entries(params.entries.size());
- for (size_t i = 0; i < params.entries.size(); ++i) {
- entries[i].name = webkit_glue::FilePathStringToWebString(
- params.entries[i].name);
- entries[i].isDirectory = params.entries[i].is_directory;
- }
- callbacks->didReadDirectory(entries, params.has_more);
+ int request_id,
+ const std::vector<base::file_util_proxy::Entry>& entries,
+ bool has_more) {
+ fileapi::FileSystemCallbackDispatcher* dispatcher =
+ dispatchers_.Lookup(request_id);
+ DCHECK(dispatcher);
+ dispatcher->DidReadDirectory(entries, has_more);
+ dispatchers_.Remove(request_id);
}
-void FileSystemDispatcher::DidFail(int request_id, WebFileError code) {
- WebFileSystemCallbacks* callbacks = callbacks_.Lookup(request_id);
- DCHECK(callbacks);
- callbacks_.Remove(request_id);
- callbacks->didFail(code);
+void FileSystemDispatcher::DidFail(
+ int request_id, base::PlatformFileError error_code) {
+ fileapi::FileSystemCallbackDispatcher* dispatcher =
+ dispatchers_.Lookup(request_id);
+ DCHECK(dispatcher);
+ dispatcher->DidFail(error_code);
+ dispatchers_.Remove(request_id);
}
diff --git a/chrome/common/file_system/file_system_dispatcher.h b/chrome/common/file_system/file_system_dispatcher.h
index 6fb9db5..8214b1c 100644
--- a/chrome/common/file_system/file_system_dispatcher.h
+++ b/chrome/common/file_system/file_system_dispatcher.h
@@ -8,24 +8,19 @@
#include <vector>
#include "base/basictypes.h"
+#include "base/file_util_proxy.h"
#include "base/id_map.h"
#include "base/nullable_string16.h"
#include "googleurl/src/gurl.h"
#include "ipc/ipc_channel.h"
#include "ipc/ipc_message.h"
-#include "third_party/WebKit/WebKit/chromium/public/WebFileError.h"
-
-namespace WebKit {
-struct WebFileInfo;
-class WebFileSystemCallbacks;
-struct WebFileSystemEntry;
-}
+#include "webkit/fileapi/file_system_callback_dispatcher.h"
namespace base {
struct PlatformFileInfo;
}
-struct ViewMsg_FileSystem_DidReadDirectory_Params;
+class FilePath;
// Dispatches and sends file system related messages sent to/from a child
// process from/to the main browser process. There is one instance
@@ -37,45 +32,38 @@ class FileSystemDispatcher {
bool OnMessageReceived(const IPC::Message& msg);
- void Move(
- const string16& src_path,
- const string16& dest_path,
- WebKit::WebFileSystemCallbacks* callbacks);
- void Copy(
- const string16& src_path,
- const string16& dest_path,
- WebKit::WebFileSystemCallbacks* callbacks);
- void Remove(
- const string16& path,
- WebKit::WebFileSystemCallbacks* callbacks);
- void ReadMetadata(
- const string16& path,
- WebKit::WebFileSystemCallbacks* callbacks);
- void Create(
- const string16& path,
- bool exclusive,
- bool for_directory,
- WebKit::WebFileSystemCallbacks* callbacks);
- void Exists(
- const string16& path,
- bool for_directory,
- WebKit::WebFileSystemCallbacks* callbacks);
- void ReadDirectory(
- const string16& path,
- WebKit::WebFileSystemCallbacks* callbacks);
+ bool Move(const FilePath& src_path,
+ const FilePath& dest_path,
+ fileapi::FileSystemCallbackDispatcher* dispatcher);
+ bool Copy(const FilePath& src_path,
+ const FilePath& dest_path,
+ fileapi::FileSystemCallbackDispatcher* dispatcher);
+ bool Remove(const FilePath& path,
+ fileapi::FileSystemCallbackDispatcher* dispatcher);
+ bool ReadMetadata(const FilePath& path,
+ fileapi::FileSystemCallbackDispatcher* dispatcher);
+ bool Create(const FilePath& path,
+ bool exclusive,
+ bool is_directory,
+ bool recursive,
+ fileapi::FileSystemCallbackDispatcher* dispatcher);
+ bool Exists(const FilePath& path,
+ bool for_directory,
+ fileapi::FileSystemCallbackDispatcher* dispatcher);
+ bool ReadDirectory(const FilePath& path,
+ fileapi::FileSystemCallbackDispatcher* dispatcher);
private:
void DidSucceed(int request_id);
- void DidReadMetadata(
- int request_id,
- const base::PlatformFileInfo& file_info);
+ void DidReadMetadata(int request_id,
+ const base::PlatformFileInfo& file_info);
void DidReadDirectory(
- const ViewMsg_FileSystem_DidReadDirectory_Params& params);
- void DidFail(
int request_id,
- WebKit::WebFileError);
+ const std::vector<base::file_util_proxy::Entry>& entries,
+ bool has_more);
+ void DidFail(int request_id, base::PlatformFileError error_code);
- IDMap<WebKit::WebFileSystemCallbacks> callbacks_;
+ IDMap<fileapi::FileSystemCallbackDispatcher, IDMapOwnPointer> dispatchers_;
DISALLOW_COPY_AND_ASSIGN(FileSystemDispatcher);
};
diff --git a/chrome/common/file_system/webfilesystem_impl.cc b/chrome/common/file_system/webfilesystem_impl.cc
index 49a07d6..546ed25 100644
--- a/chrome/common/file_system/webfilesystem_impl.cc
+++ b/chrome/common/file_system/webfilesystem_impl.cc
@@ -6,73 +6,164 @@
#include "chrome/common/file_system/file_system_dispatcher.h"
#include "chrome/common/child_thread.h"
+#include "third_party/WebKit/WebKit/chromium/public/WebFileInfo.h"
+#include "third_party/WebKit/WebKit/chromium/public/WebFileSystemCallbacks.h"
+#include "third_party/WebKit/WebKit/chromium/public/WebString.h"
+#include "webkit/glue/webkit_glue.h"
-using WebKit::WebString;
+using WebKit::WebFileInfo;
using WebKit::WebFileSystemCallbacks;
+using WebKit::WebFileSystemEntry;
+using WebKit::WebString;
+using WebKit::WebVector;
+
+namespace {
+
+WebKit::WebFileError PlatformFileErrorToWebFileError(
+ base::PlatformFileError error_code) {
+ switch (error_code) {
+ case base::PLATFORM_FILE_ERROR_NOT_FOUND:
+ return WebKit::WebFileErrorNotFound;
+ case base::PLATFORM_FILE_ERROR_INVALID_OPERATION:
+ case base::PLATFORM_FILE_ERROR_EXISTS:
+ case base::PLATFORM_FILE_ERROR_NOT_A_DIRECTORY:
+ return WebKit::WebFileErrorInvalidModification;
+ case base::PLATFORM_FILE_ERROR_ACCESS_DENIED:
+ return WebKit::WebFileErrorNoModificationAllowed;
+ case base::PLATFORM_FILE_ERROR_FAILED:
+ return WebKit::WebFileErrorInvalidState;
+ case base::PLATFORM_FILE_ERROR_ABORT:
+ return WebKit::WebFileErrorAbort;
+ default:
+ return WebKit::WebFileErrorInvalidModification;
+ }
+}
+
+class WebFileSystemCallbackDispatcherImpl
+ : public fileapi::FileSystemCallbackDispatcher {
+ public:
+ explicit WebFileSystemCallbackDispatcherImpl(
+ WebFileSystemCallbacks* callbacks)
+ : callbacks_(callbacks) {
+ DCHECK(callbacks_);
+ }
+
+ virtual ~WebFileSystemCallbackDispatcherImpl() {
+ }
+
+ // FileSystemCallbackDispatcher implementation
+ virtual void DidSucceed() {
+ callbacks_->didSucceed();
+ }
+
+ virtual void DidReadMetadata(const base::PlatformFileInfo& file_info) {
+ WebFileInfo web_file_info;
+ web_file_info.modificationTime = file_info.last_modified.ToDoubleT();
+ callbacks_->didReadMetadata(web_file_info);
+ }
+
+ virtual void DidReadDirectory(
+ const std::vector<base::file_util_proxy::Entry>& entries, bool has_more) {
+ WebVector<WebFileSystemEntry> file_system_entries(entries.size());
+ for (size_t i = 0; i < entries.size(); i++) {
+ file_system_entries[i].name =
+ webkit_glue::FilePathStringToWebString(entries[i].name);
+ file_system_entries[i].isDirectory = entries[i].is_directory;
+ }
+ callbacks_->didReadDirectory(file_system_entries, has_more);
+ }
+
+ virtual void DidOpenFileSystem(const string16&, const FilePath&) {
+ NOTREACHED();
+ }
+
+ virtual void DidFail(base::PlatformFileError error_code) {
+ callbacks_->didFail(PlatformFileErrorToWebFileError(error_code));
+ }
+
+ private:
+ WebFileSystemCallbacks* callbacks_;
+};
+
+} // namespace
WebFileSystemImpl::WebFileSystemImpl() {
}
void WebFileSystemImpl::move(const WebString& src_path,
- const WebString& dest_path, WebFileSystemCallbacks* callbacks) {
+ const WebString& dest_path,
+ WebFileSystemCallbacks* callbacks) {
FileSystemDispatcher* dispatcher =
ChildThread::current()->file_system_dispatcher();
- dispatcher->Move(src_path, dest_path, callbacks);
+ dispatcher->Move(webkit_glue::WebStringToFilePath(src_path),
+ webkit_glue::WebStringToFilePath(dest_path),
+ new WebFileSystemCallbackDispatcherImpl(callbacks));
}
-void WebFileSystemImpl::copy(const WebKit::WebString& src_path,
- const WebKit::WebString& dest_path,
- WebKit::WebFileSystemCallbacks* callbacks) {
+void WebFileSystemImpl::copy(const WebString& src_path,
+ const WebString& dest_path,
+ WebFileSystemCallbacks* callbacks) {
FileSystemDispatcher* dispatcher =
ChildThread::current()->file_system_dispatcher();
- dispatcher->Copy(src_path, dest_path, callbacks);
+ dispatcher->Copy(webkit_glue::WebStringToFilePath(src_path),
+ webkit_glue::WebStringToFilePath(dest_path),
+ new WebFileSystemCallbackDispatcherImpl(callbacks));
}
void WebFileSystemImpl::remove(const WebString& path,
- WebFileSystemCallbacks* callbacks) {
+ WebFileSystemCallbacks* callbacks) {
FileSystemDispatcher* dispatcher =
ChildThread::current()->file_system_dispatcher();
- dispatcher->Remove(path, callbacks);
+ dispatcher->Remove(webkit_glue::WebStringToFilePath(path),
+ new WebFileSystemCallbackDispatcherImpl(callbacks));
}
void WebFileSystemImpl::readMetadata(const WebString& path,
- WebFileSystemCallbacks* callbacks) {
+ WebFileSystemCallbacks* callbacks) {
FileSystemDispatcher* dispatcher =
ChildThread::current()->file_system_dispatcher();
- dispatcher->ReadMetadata(path, callbacks);
+ dispatcher->ReadMetadata(webkit_glue::WebStringToFilePath(path),
+ new WebFileSystemCallbackDispatcherImpl(callbacks));
}
void WebFileSystemImpl::createFile(const WebString& path,
- bool exclusive, WebFileSystemCallbacks* callbacks) {
+ bool exclusive,
+ WebFileSystemCallbacks* callbacks) {
FileSystemDispatcher* dispatcher =
ChildThread::current()->file_system_dispatcher();
- dispatcher->Create(path, exclusive, false, callbacks);
+ dispatcher->Create(webkit_glue::WebStringToFilePath(path), exclusive, false,
+ false, new WebFileSystemCallbackDispatcherImpl(callbacks));
}
void WebFileSystemImpl::createDirectory(const WebString& path,
- bool exclusive, WebFileSystemCallbacks* callbacks) {
+ bool exclusive,
+ WebFileSystemCallbacks* callbacks) {
FileSystemDispatcher* dispatcher =
ChildThread::current()->file_system_dispatcher();
- dispatcher->Create(path, exclusive, true, callbacks);
+ dispatcher->Create(webkit_glue::WebStringToFilePath(path), exclusive, true,
+ false, new WebFileSystemCallbackDispatcherImpl(callbacks));
}
void WebFileSystemImpl::fileExists(const WebString& path,
- WebFileSystemCallbacks* callbacks) {
+ WebFileSystemCallbacks* callbacks) {
FileSystemDispatcher* dispatcher =
ChildThread::current()->file_system_dispatcher();
- dispatcher->Exists(path, false, callbacks);
+ dispatcher->Exists(webkit_glue::WebStringToFilePath(path), false,
+ new WebFileSystemCallbackDispatcherImpl(callbacks));
}
void WebFileSystemImpl::directoryExists(const WebString& path,
- WebFileSystemCallbacks* callbacks) {
+ WebFileSystemCallbacks* callbacks) {
FileSystemDispatcher* dispatcher =
ChildThread::current()->file_system_dispatcher();
- dispatcher->Exists(path, true, callbacks);
+ dispatcher->Exists(webkit_glue::WebStringToFilePath(path), true,
+ new WebFileSystemCallbackDispatcherImpl(callbacks));
}
void WebFileSystemImpl::readDirectory(const WebString& path,
- WebFileSystemCallbacks* callbacks) {
+ WebFileSystemCallbacks* callbacks) {
FileSystemDispatcher* dispatcher =
ChildThread::current()->file_system_dispatcher();
- dispatcher->ReadDirectory(path, callbacks);
+ dispatcher->ReadDirectory(webkit_glue::WebStringToFilePath(path),
+ new WebFileSystemCallbackDispatcherImpl(callbacks));
}
diff --git a/chrome/common/render_messages.h b/chrome/common/render_messages.h
index 8d7a973..4fcb1e5 100644
--- a/chrome/common/render_messages.h
+++ b/chrome/common/render_messages.h
@@ -106,7 +106,6 @@ struct ViewMsg_ExtensionsUpdated_Params;
struct ViewMsg_DeviceOrientationUpdated_Params;
struct ViewHostMsg_DomMessage_Params;
struct ViewHostMsg_OpenFileSystemRequest_Params;
-struct ViewMsg_FileSystem_DidReadDirectory_Params;
struct ViewHostMsg_AccessibilityNotification_Params;
// Values that may be OR'd together to form the 'flags' parameter of the
diff --git a/chrome/common/render_messages_internal.h b/chrome/common/render_messages_internal.h
index 070123d..f391223 100644
--- a/chrome/common/render_messages_internal.h
+++ b/chrome/common/render_messages_internal.h
@@ -47,6 +47,12 @@ class SkBitmap;
struct ThumbnailScore;
class WebCursor;
+namespace base {
+namespace file_util_proxy {
+struct Entry;
+}
+}
+
namespace IPC {
struct ChannelHandle;
class Message;
@@ -1035,11 +1041,14 @@ IPC_BEGIN_MESSAGES(View)
IPC_MESSAGE_CONTROL2(ViewMsg_FileSystem_DidReadMetadata,
int /* request_id */,
base::PlatformFileInfo)
- IPC_MESSAGE_CONTROL1(ViewMsg_FileSystem_DidReadDirectory,
- ViewMsg_FileSystem_DidReadDirectory_Params)
+ IPC_MESSAGE_CONTROL3(ViewMsg_FileSystem_DidReadDirectory,
+ int /* request_id */,
+ std::vector<base::file_util_proxy::Entry> /* entries */,
+ bool /* has_more */)
+
IPC_MESSAGE_CONTROL2(ViewMsg_FileSystem_DidFail,
int /* request_id */,
- WebKit::WebFileError /* error_code */)
+ base::PlatformFileError /* error_code */)
// The response to ViewHostMsg_AsyncOpenFile.
IPC_MESSAGE_ROUTED3(ViewMsg_AsyncOpenFile_ACK,
@@ -2816,11 +2825,12 @@ IPC_BEGIN_MESSAGES(ViewHost)
FilePath /* path */)
// WebFileSystem::create() message.
- IPC_MESSAGE_CONTROL4(ViewHostMsg_FileSystem_Create,
+ IPC_MESSAGE_CONTROL5(ViewHostMsg_FileSystem_Create,
int /* request_id */,
FilePath /* path */,
bool /* exclusive */,
- bool /* is_directory */)
+ bool /* is_directory */,
+ bool /* recursive */)
// WebFileSystem::exists() messages.
IPC_MESSAGE_CONTROL3(ViewHostMsg_FileSystem_Exists,
diff --git a/chrome/common/render_messages_params.cc b/chrome/common/render_messages_params.cc
index 325de2f..4fd83a3 100644
--- a/chrome/common/render_messages_params.cc
+++ b/chrome/common/render_messages_params.cc
@@ -325,16 +325,6 @@ ViewHostMsg_OpenFileSystemRequest_Params::
~ViewHostMsg_OpenFileSystemRequest_Params() {
}
-ViewMsg_FileSystem_DidReadDirectory_Params::
- ViewMsg_FileSystem_DidReadDirectory_Params()
- : request_id(0),
- has_more(false) {
-}
-
-ViewMsg_FileSystem_DidReadDirectory_Params::
- ~ViewMsg_FileSystem_DidReadDirectory_Params() {
-}
-
namespace IPC {
// Self contained templates which are only used inside serializing Params
@@ -1809,36 +1799,6 @@ void ParamTraits<ViewHostMsg_OpenFileSystemRequest_Params>::Log(
l->append(")");
}
-void ParamTraits<ViewMsg_FileSystem_DidReadDirectory_Params>::Write(
- Message* m,
- const param_type& p) {
- WriteParam(m, p.request_id);
- WriteParam(m, p.entries);
- WriteParam(m, p.has_more);
-}
-
-bool ParamTraits<ViewMsg_FileSystem_DidReadDirectory_Params>::Read(
- const Message* m,
- void** iter,
- param_type* p) {
- return
- ReadParam(m, iter, &p->request_id) &&
- ReadParam(m, iter, &p->entries) &&
- ReadParam(m, iter, &p->has_more);
-}
-
-void ParamTraits<ViewMsg_FileSystem_DidReadDirectory_Params>::Log(
- const param_type& p,
- std::string* l) {
- l->append("(");
- LogParam(p.request_id, l);
- l->append(", ");
- LogParam(p.entries, l);
- l->append(", ");
- LogParam(p.has_more, l);
- l->append(")");
-}
-
void ParamTraits<base::file_util_proxy::Entry>::Write(
Message* m,
const param_type& p) {
diff --git a/chrome/common/render_messages_params.h b/chrome/common/render_messages_params.h
index 4847695..70f9825 100644
--- a/chrome/common/render_messages_params.h
+++ b/chrome/common/render_messages_params.h
@@ -964,20 +964,6 @@ struct ViewHostMsg_OpenFileSystemRequest_Params {
int64 requested_size;
};
-struct ViewMsg_FileSystem_DidReadDirectory_Params {
- ViewMsg_FileSystem_DidReadDirectory_Params();
- ~ViewMsg_FileSystem_DidReadDirectory_Params();
-
- // The response should have this id.
- int request_id;
-
- // A vector of directory entries.
- std::vector<base::file_util_proxy::Entry> entries;
-
- // Indicates if there will be more entries.
- bool has_more;
-};
-
struct ViewHostMsg_AccessibilityNotification_Params {
enum NotificationType {
// The node checked state has changed.
@@ -1259,14 +1245,6 @@ struct ParamTraits<ViewHostMsg_OpenFileSystemRequest_Params> {
};
template <>
-struct ParamTraits<ViewMsg_FileSystem_DidReadDirectory_Params> {
- typedef ViewMsg_FileSystem_DidReadDirectory_Params param_type;
- static void Write(Message* m, const param_type& p);
- static bool Read(const Message* m, void** iter, param_type* p);
- static void Log(const param_type& p, std::string* l);
-};
-
-template <>
struct ParamTraits<base::file_util_proxy::Entry> {
typedef base::file_util_proxy::Entry param_type;
static void Write(Message* m, const param_type& p);