summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormtomasz@chromium.org <mtomasz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-04-21 03:20:48 +0000
committermtomasz@chromium.org <mtomasz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-04-21 03:20:48 +0000
commit43420a1ff71722d6d7936f27c2d3291a79344439 (patch)
treebb4efab4dd98e10ddc023a5c6f80818fb0f498bb
parent456c82bdb48d2bd175267a5fa3d300825e21f11f (diff)
downloadchromium_src-43420a1ff71722d6d7936f27c2d3291a79344439.zip
chromium_src-43420a1ff71722d6d7936f27c2d3291a79344439.tar.gz
chromium_src-43420a1ff71722d6d7936f27c2d3291a79344439.tar.bz2
[fsp] [recommit #2] Add an initial AsyncFileUtil.
This patch adds the AsyncFileUtil implementation for the file system provider. It does not communicate with the file system provider service yet. Currently, for not supported operations SECURITY error is returned. For allowed, but not implemented operations, it is NOT_FOUND error. Unit tests are quite trivial at this stage, but they will grow once more operations are implemented. This patch has been previously committed and reverted due to test failures. See: https://codereview.chromium.org/236303017/ Later, this patch got again reverted because of ASAN failures. See: https://codereview.chromium.org/242493002/ TEST=unit_test: FileSystemProviderAsyncFileUtilTest* BUG=248427 Review URL: https://codereview.chromium.org/243703005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@264962 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/chrome_content_browser_client.cc14
-rw-r--r--chrome/browser/chromeos/file_system_provider/fileapi/backend_delegate.cc54
-rw-r--r--chrome/browser/chromeos/file_system_provider/fileapi/backend_delegate.h48
-rw-r--r--chrome/browser/chromeos/file_system_provider/fileapi/provider_async_file_util.cc172
-rw-r--r--chrome/browser/chromeos/file_system_provider/fileapi/provider_async_file_util.h110
-rw-r--r--chrome/browser/chromeos/file_system_provider/fileapi/provider_async_file_util_unittest.cc423
-rw-r--r--chrome/browser/chromeos/fileapi/file_system_backend.cc20
-rw-r--r--chrome/browser/chromeos/fileapi/file_system_backend.h9
-rw-r--r--chrome/browser/chromeos/fileapi/file_system_backend_unittest.cc31
-rw-r--r--chrome/chrome_browser_chromeos.gypi4
-rw-r--r--chrome/chrome_tests_unit.gypi1
11 files changed, 859 insertions, 27 deletions
diff --git a/chrome/browser/chrome_content_browser_client.cc b/chrome/browser/chrome_content_browser_client.cc
index 59db60e..f99bd3b 100644
--- a/chrome/browser/chrome_content_browser_client.cc
+++ b/chrome/browser/chrome_content_browser_client.cc
@@ -45,7 +45,6 @@
#include "chrome/browser/guestview/guestview.h"
#include "chrome/browser/guestview/guestview_constants.h"
#include "chrome/browser/guestview/webview/webview_guest.h"
-#include "chrome/browser/local_discovery/storage/privet_filesystem_backend.h"
#include "chrome/browser/media/cast_transport_host_filter.h"
#include "chrome/browser/media/media_capture_devices_dispatcher.h"
#include "chrome/browser/metrics/chrome_browser_main_extra_parts_metrics.h"
@@ -166,6 +165,7 @@
#elif defined(OS_CHROMEOS)
#include "chrome/browser/chromeos/chrome_browser_main_chromeos.h"
#include "chrome/browser/chromeos/drive/fileapi/file_system_backend_delegate.h"
+#include "chrome/browser/chromeos/file_system_provider/fileapi/backend_delegate.h"
#include "chrome/browser/chromeos/fileapi/file_system_backend.h"
#include "chrome/browser/chromeos/login/startup_utils.h"
#include "chrome/browser/chromeos/login/user_manager.h"
@@ -2545,12 +2545,12 @@ void ChromeContentBrowserClient::GetAdditionalFileSystemBackends(
fileapi::ExternalMountPoints* external_mount_points =
content::BrowserContext::GetMountPoints(browser_context);
DCHECK(external_mount_points);
- chromeos::FileSystemBackend* backend =
- new chromeos::FileSystemBackend(
- new drive::FileSystemBackendDelegate,
- browser_context->GetSpecialStoragePolicy(),
- external_mount_points,
- fileapi::ExternalMountPoints::GetSystemInstance());
+ chromeos::FileSystemBackend* backend = new chromeos::FileSystemBackend(
+ new drive::FileSystemBackendDelegate,
+ new chromeos::file_system_provider::BackendDelegate,
+ browser_context->GetSpecialStoragePolicy(),
+ external_mount_points,
+ fileapi::ExternalMountPoints::GetSystemInstance());
backend->AddSystemMountPoints();
DCHECK(backend->CanHandleType(fileapi::kFileSystemTypeExternal));
additional_backends->push_back(backend);
diff --git a/chrome/browser/chromeos/file_system_provider/fileapi/backend_delegate.cc b/chrome/browser/chromeos/file_system_provider/fileapi/backend_delegate.cc
new file mode 100644
index 0000000..bf3f8b4
--- /dev/null
+++ b/chrome/browser/chromeos/file_system_provider/fileapi/backend_delegate.cc
@@ -0,0 +1,54 @@
+// Copyright 2014 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/chromeos/file_system_provider/fileapi/backend_delegate.h"
+
+#include "base/memory/scoped_ptr.h"
+#include "chrome/browser/chromeos/file_system_provider/fileapi/provider_async_file_util.h"
+#include "content/public/browser/browser_thread.h"
+#include "webkit/browser/blob/file_stream_reader.h"
+#include "webkit/browser/fileapi/file_stream_writer.h"
+#include "webkit/browser/fileapi/file_system_url.h"
+
+using content::BrowserThread;
+
+namespace chromeos {
+namespace file_system_provider {
+
+BackendDelegate::BackendDelegate()
+ : async_file_util_(new internal::ProviderAsyncFileUtil) {}
+
+BackendDelegate::~BackendDelegate() {}
+
+fileapi::AsyncFileUtil* BackendDelegate::GetAsyncFileUtil(
+ fileapi::FileSystemType type) {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
+ DCHECK_EQ(fileapi::kFileSystemTypeProvided, type);
+ return async_file_util_.get();
+}
+
+scoped_ptr<webkit_blob::FileStreamReader>
+BackendDelegate::CreateFileStreamReader(
+ const fileapi::FileSystemURL& url,
+ int64 offset,
+ const base::Time& expected_modification_time,
+ fileapi::FileSystemContext* context) {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
+ DCHECK_EQ(fileapi::kFileSystemTypeProvided, url.type());
+ NOTIMPLEMENTED();
+ return scoped_ptr<webkit_blob::FileStreamReader>();
+}
+
+scoped_ptr<fileapi::FileStreamWriter> BackendDelegate::CreateFileStreamWriter(
+ const fileapi::FileSystemURL& url,
+ int64 offset,
+ fileapi::FileSystemContext* context) {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
+ DCHECK_EQ(fileapi::kFileSystemTypeProvided, url.type());
+ NOTIMPLEMENTED();
+ return scoped_ptr<fileapi::FileStreamWriter>();
+}
+
+} // namespace file_system_provider
+} // namespace chromeos
diff --git a/chrome/browser/chromeos/file_system_provider/fileapi/backend_delegate.h b/chrome/browser/chromeos/file_system_provider/fileapi/backend_delegate.h
new file mode 100644
index 0000000..c4794486
--- /dev/null
+++ b/chrome/browser/chromeos/file_system_provider/fileapi/backend_delegate.h
@@ -0,0 +1,48 @@
+// Copyright 2014 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_CHROMEOS_FILE_SYSTEM_PROVIDER_FILEAPI_BACKEND_DELEGATE_H_
+#define CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_FILEAPI_BACKEND_DELEGATE_H_
+
+#include "base/basictypes.h"
+#include "base/memory/scoped_ptr.h"
+#include "chrome/browser/chromeos/fileapi/file_system_backend_delegate.h"
+
+namespace fileapi {
+class AsyncFileUtil;
+} // namespace fileapi
+
+namespace chromeos {
+namespace file_system_provider {
+
+// Delegate implementation of the some methods in chromeos::FileSystemBackend
+// for provided file systems.
+class BackendDelegate : public chromeos::FileSystemBackendDelegate {
+ public:
+ BackendDelegate();
+ virtual ~BackendDelegate();
+
+ // FileSystemBackend::Delegate overrides.
+ virtual fileapi::AsyncFileUtil* GetAsyncFileUtil(fileapi::FileSystemType type)
+ OVERRIDE;
+ virtual scoped_ptr<webkit_blob::FileStreamReader> CreateFileStreamReader(
+ const fileapi::FileSystemURL& url,
+ int64 offset,
+ const base::Time& expected_modification_time,
+ fileapi::FileSystemContext* context) OVERRIDE;
+ virtual scoped_ptr<fileapi::FileStreamWriter> CreateFileStreamWriter(
+ const fileapi::FileSystemURL& url,
+ int64 offset,
+ fileapi::FileSystemContext* context) OVERRIDE;
+
+ private:
+ scoped_ptr<fileapi::AsyncFileUtil> async_file_util_;
+
+ DISALLOW_COPY_AND_ASSIGN(BackendDelegate);
+};
+
+} // namespace file_system_provider
+} // namespace chromeos
+
+#endif // CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_FILEAPI_BACKEND_DELEGATE_H_
diff --git a/chrome/browser/chromeos/file_system_provider/fileapi/provider_async_file_util.cc b/chrome/browser/chromeos/file_system_provider/fileapi/provider_async_file_util.cc
new file mode 100644
index 0000000..b4a5cce
--- /dev/null
+++ b/chrome/browser/chromeos/file_system_provider/fileapi/provider_async_file_util.cc
@@ -0,0 +1,172 @@
+// Copyright 2014 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/chromeos/file_system_provider/fileapi/provider_async_file_util.h"
+
+#include "base/callback.h"
+#include "base/files/file_path.h"
+#include "base/logging.h"
+#include "base/platform_file.h"
+#include "content/public/browser/browser_thread.h"
+#include "webkit/browser/fileapi/file_system_operation_context.h"
+#include "webkit/browser/fileapi/file_system_url.h"
+#include "webkit/common/blob/shareable_file_reference.h"
+
+using content::BrowserThread;
+
+namespace chromeos {
+namespace file_system_provider {
+namespace internal {
+
+ProviderAsyncFileUtil::ProviderAsyncFileUtil() {}
+
+ProviderAsyncFileUtil::~ProviderAsyncFileUtil() {}
+
+void ProviderAsyncFileUtil::CreateOrOpen(
+ scoped_ptr<fileapi::FileSystemOperationContext> context,
+ const fileapi::FileSystemURL& url,
+ int file_flags,
+ const CreateOrOpenCallback& callback) {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
+ base::PlatformFile platform_file = base::kInvalidPlatformFileValue;
+ if ((file_flags & base::PLATFORM_FILE_CREATE) ||
+ (file_flags & base::PLATFORM_FILE_OPEN_ALWAYS) ||
+ (file_flags & base::PLATFORM_FILE_CREATE_ALWAYS) ||
+ (file_flags & base::PLATFORM_FILE_OPEN_TRUNCATED)) {
+ callback.Run(base::File::FILE_ERROR_SECURITY,
+ base::PassPlatformFile(&platform_file),
+ base::Closure());
+ return;
+ }
+
+ NOTIMPLEMENTED();
+ callback.Run(base::File::FILE_ERROR_NOT_FOUND,
+ base::PassPlatformFile(&platform_file),
+ base::Closure());
+}
+
+void ProviderAsyncFileUtil::EnsureFileExists(
+ scoped_ptr<fileapi::FileSystemOperationContext> context,
+ const fileapi::FileSystemURL& url,
+ const EnsureFileExistsCallback& callback) {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
+ callback.Run(base::File::FILE_ERROR_SECURITY, false /* created */);
+}
+
+void ProviderAsyncFileUtil::CreateDirectory(
+ scoped_ptr<fileapi::FileSystemOperationContext> context,
+ const fileapi::FileSystemURL& url,
+ bool exclusive,
+ bool recursive,
+ const StatusCallback& callback) {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
+ callback.Run(base::File::FILE_ERROR_SECURITY);
+}
+
+void ProviderAsyncFileUtil::GetFileInfo(
+ scoped_ptr<fileapi::FileSystemOperationContext> context,
+ const fileapi::FileSystemURL& url,
+ const GetFileInfoCallback& callback) {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
+ NOTIMPLEMENTED();
+ callback.Run(base::File::FILE_ERROR_NOT_FOUND, base::File::Info());
+}
+
+void ProviderAsyncFileUtil::ReadDirectory(
+ scoped_ptr<fileapi::FileSystemOperationContext> context,
+ const fileapi::FileSystemURL& url,
+ const ReadDirectoryCallback& callback) {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
+ NOTIMPLEMENTED();
+ callback.Run(base::File::FILE_ERROR_NOT_FOUND, EntryList(), false);
+}
+
+void ProviderAsyncFileUtil::Touch(
+ scoped_ptr<fileapi::FileSystemOperationContext> context,
+ const fileapi::FileSystemURL& url,
+ const base::Time& last_access_time,
+ const base::Time& last_modified_time,
+ const StatusCallback& callback) {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
+ callback.Run(base::File::FILE_ERROR_SECURITY);
+}
+
+void ProviderAsyncFileUtil::Truncate(
+ scoped_ptr<fileapi::FileSystemOperationContext> context,
+ const fileapi::FileSystemURL& url,
+ int64 length,
+ const StatusCallback& callback) {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
+ callback.Run(base::File::FILE_ERROR_SECURITY);
+}
+
+void ProviderAsyncFileUtil::CopyFileLocal(
+ scoped_ptr<fileapi::FileSystemOperationContext> context,
+ const fileapi::FileSystemURL& src_url,
+ const fileapi::FileSystemURL& dest_url,
+ CopyOrMoveOption option,
+ const CopyFileProgressCallback& progress_callback,
+ const StatusCallback& callback) {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
+ callback.Run(base::File::FILE_ERROR_SECURITY);
+}
+
+void ProviderAsyncFileUtil::MoveFileLocal(
+ scoped_ptr<fileapi::FileSystemOperationContext> context,
+ const fileapi::FileSystemURL& src_url,
+ const fileapi::FileSystemURL& dest_url,
+ CopyOrMoveOption option,
+ const StatusCallback& callback) {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
+ callback.Run(base::File::FILE_ERROR_SECURITY);
+}
+
+void ProviderAsyncFileUtil::CopyInForeignFile(
+ scoped_ptr<fileapi::FileSystemOperationContext> context,
+ const base::FilePath& src_file_path,
+ const fileapi::FileSystemURL& dest_url,
+ const StatusCallback& callback) {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
+ callback.Run(base::File::FILE_ERROR_SECURITY);
+}
+
+void ProviderAsyncFileUtil::DeleteFile(
+ scoped_ptr<fileapi::FileSystemOperationContext> context,
+ const fileapi::FileSystemURL& url,
+ const StatusCallback& callback) {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
+ callback.Run(base::File::FILE_ERROR_SECURITY);
+}
+
+void ProviderAsyncFileUtil::DeleteDirectory(
+ scoped_ptr<fileapi::FileSystemOperationContext> context,
+ const fileapi::FileSystemURL& url,
+ const StatusCallback& callback) {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
+ callback.Run(base::File::FILE_ERROR_SECURITY);
+}
+
+void ProviderAsyncFileUtil::DeleteRecursively(
+ scoped_ptr<fileapi::FileSystemOperationContext> context,
+ const fileapi::FileSystemURL& url,
+ const StatusCallback& callback) {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
+ callback.Run(base::File::FILE_ERROR_SECURITY);
+}
+
+void ProviderAsyncFileUtil::CreateSnapshotFile(
+ scoped_ptr<fileapi::FileSystemOperationContext> context,
+ const fileapi::FileSystemURL& url,
+ const CreateSnapshotFileCallback& callback) {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
+ NOTIMPLEMENTED();
+ callback.Run(base::File::FILE_ERROR_NOT_FOUND,
+ base::File::Info(),
+ base::FilePath(),
+ scoped_refptr<webkit_blob::ShareableFileReference>());
+}
+
+} // namespace internal
+} // namespace file_system_provider
+} // namespace chromeos
diff --git a/chrome/browser/chromeos/file_system_provider/fileapi/provider_async_file_util.h b/chrome/browser/chromeos/file_system_provider/fileapi/provider_async_file_util.h
new file mode 100644
index 0000000..a60df56
--- /dev/null
+++ b/chrome/browser/chromeos/file_system_provider/fileapi/provider_async_file_util.h
@@ -0,0 +1,110 @@
+// Copyright 2014 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_CHROMEOS_FILE_SYSTEM_PROVIDER_FILEAPI_PROVIDER_ASYNC_FILE_UTIL_H_
+#define CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_FILEAPI_PROVIDER_ASYNC_FILE_UTIL_H_
+
+#include "base/basictypes.h"
+#include "base/callback.h"
+#include "webkit/browser/fileapi/async_file_util.h"
+
+namespace chromeos {
+namespace file_system_provider {
+
+class FileSystemInterface;
+
+namespace internal {
+
+// The implementation of fileapi::AsyncFileUtil for provided file systems. It is
+// created one per Chrome process. It is responsible for routing calls to the
+// correct profile, and then to the correct profided file system.
+//
+// This class should be called AsyncFileUtil, without the Provided prefix. This
+// is impossible, though because of GYP limitations. There must not be two files
+// with the same name in a Chromium tree.
+// See: https://code.google.com/p/gyp/issues/detail?id=384
+//
+// All of the methods should be called on the IO thread.
+class ProviderAsyncFileUtil : public fileapi::AsyncFileUtil {
+ public:
+ ProviderAsyncFileUtil();
+ virtual ~ProviderAsyncFileUtil();
+
+ // fileapi::AsyncFileUtil overrides.
+ virtual void CreateOrOpen(
+ scoped_ptr<fileapi::FileSystemOperationContext> context,
+ const fileapi::FileSystemURL& url,
+ int file_flags,
+ const CreateOrOpenCallback& callback) OVERRIDE;
+ virtual void EnsureFileExists(
+ scoped_ptr<fileapi::FileSystemOperationContext> context,
+ const fileapi::FileSystemURL& url,
+ const EnsureFileExistsCallback& callback) OVERRIDE;
+ virtual void CreateDirectory(
+ scoped_ptr<fileapi::FileSystemOperationContext> context,
+ const fileapi::FileSystemURL& url,
+ bool exclusive,
+ bool recursive,
+ const StatusCallback& callback) OVERRIDE;
+ virtual void GetFileInfo(
+ scoped_ptr<fileapi::FileSystemOperationContext> context,
+ const fileapi::FileSystemURL& url,
+ const GetFileInfoCallback& callback) OVERRIDE;
+ virtual void ReadDirectory(
+ scoped_ptr<fileapi::FileSystemOperationContext> context,
+ const fileapi::FileSystemURL& url,
+ const ReadDirectoryCallback& callback) OVERRIDE;
+ virtual void Touch(scoped_ptr<fileapi::FileSystemOperationContext> context,
+ const fileapi::FileSystemURL& url,
+ const base::Time& last_access_time,
+ const base::Time& last_modified_time,
+ const StatusCallback& callback) OVERRIDE;
+ virtual void Truncate(scoped_ptr<fileapi::FileSystemOperationContext> context,
+ const fileapi::FileSystemURL& url,
+ int64 length,
+ const StatusCallback& callback) OVERRIDE;
+ virtual void CopyFileLocal(
+ scoped_ptr<fileapi::FileSystemOperationContext> context,
+ const fileapi::FileSystemURL& src_url,
+ const fileapi::FileSystemURL& dest_url,
+ CopyOrMoveOption option,
+ const CopyFileProgressCallback& progress_callback,
+ const StatusCallback& callback) OVERRIDE;
+ virtual void MoveFileLocal(
+ scoped_ptr<fileapi::FileSystemOperationContext> context,
+ const fileapi::FileSystemURL& src_url,
+ const fileapi::FileSystemURL& dest_url,
+ CopyOrMoveOption option,
+ const StatusCallback& callback) OVERRIDE;
+ virtual void CopyInForeignFile(
+ scoped_ptr<fileapi::FileSystemOperationContext> context,
+ const base::FilePath& src_file_path,
+ const fileapi::FileSystemURL& dest_url,
+ const StatusCallback& callback) OVERRIDE;
+ virtual void DeleteFile(
+ scoped_ptr<fileapi::FileSystemOperationContext> context,
+ const fileapi::FileSystemURL& url,
+ const StatusCallback& callback) OVERRIDE;
+ virtual void DeleteDirectory(
+ scoped_ptr<fileapi::FileSystemOperationContext> context,
+ const fileapi::FileSystemURL& url,
+ const StatusCallback& callback) OVERRIDE;
+ virtual void DeleteRecursively(
+ scoped_ptr<fileapi::FileSystemOperationContext> context,
+ const fileapi::FileSystemURL& url,
+ const StatusCallback& callback) OVERRIDE;
+ virtual void CreateSnapshotFile(
+ scoped_ptr<fileapi::FileSystemOperationContext> context,
+ const fileapi::FileSystemURL& url,
+ const CreateSnapshotFileCallback& callback) OVERRIDE;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(ProviderAsyncFileUtil);
+};
+
+} // namespace internal
+} // namespace file_system_provider
+} // namespace chromeos
+
+#endif // CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_FILEAPI_PROVIDER_ASYNC_FILE_UTIL_H_
diff --git a/chrome/browser/chromeos/file_system_provider/fileapi/provider_async_file_util_unittest.cc b/chrome/browser/chromeos/file_system_provider/fileapi/provider_async_file_util_unittest.cc
new file mode 100644
index 0000000..3da58a6
--- /dev/null
+++ b/chrome/browser/chromeos/file_system_provider/fileapi/provider_async_file_util_unittest.cc
@@ -0,0 +1,423 @@
+// Copyright 2014 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 <string>
+#include <vector>
+
+#include "base/files/file.h"
+#include "base/files/file_path.h"
+#include "base/files/scoped_temp_dir.h"
+#include "base/memory/scoped_ptr.h"
+#include "base/memory/weak_ptr.h"
+#include "base/platform_file.h"
+#include "chrome/browser/chromeos/file_system_provider/fileapi/provider_async_file_util.h"
+#include "chrome/browser/chromeos/file_system_provider/mount_path_util.h"
+#include "chrome/test/base/testing_profile.h"
+#include "content/public/test/test_browser_thread_bundle.h"
+#include "content/public/test/test_file_system_context.h"
+#include "testing/gtest/include/gtest/gtest.h"
+#include "webkit/browser/fileapi/async_file_util.h"
+#include "webkit/browser/fileapi/external_mount_points.h"
+#include "webkit/browser/fileapi/file_system_context.h"
+#include "webkit/browser/fileapi/file_system_url.h"
+#include "webkit/common/blob/shareable_file_reference.h"
+
+namespace chromeos {
+namespace file_system_provider {
+namespace {
+
+const char kExtensionId[] = "mbflcebpggnecokmikipoihdbecnjfoj";
+const int kFileSystemId = 1;
+
+// Logs callbacks invocations on the tested operations.
+// TODO(mtomasz): Store and verify more arguments, once the operations return
+// anything else than just an error.
+class EventLogger {
+ public:
+ EventLogger() : weak_ptr_factory_(this) {}
+ virtual ~EventLogger() {}
+
+ void OnStatus(base::File::Error error) {
+ error_.reset(new base::File::Error(error));
+ }
+
+ void OnCreateOrOpen(base::File::Error error,
+ base::PassPlatformFile platform_file,
+ const base::Closure& on_close_callback) {
+ error_.reset(new base::File::Error(error));
+ }
+
+ void OnEnsureFileExists(base::File::Error error, bool created) {
+ error_.reset(new base::File::Error(error));
+ }
+
+ void OnGetFileInfo(base::File::Error error,
+ const base::File::Info& file_info) {
+ error_.reset(new base::File::Error(error));
+ }
+
+ void OnReadDirectory(base::File::Error error,
+ const fileapi::AsyncFileUtil::EntryList& file_list,
+ bool has_more) {
+ error_.reset(new base::File::Error(error));
+ }
+
+ void OnCreateSnapshotFile(
+ base::File::Error error,
+ const base::File::Info& file_info,
+ const base::FilePath& platform_path,
+ const scoped_refptr<webkit_blob::ShareableFileReference>& file_ref) {
+ error_.reset(new base::File::Error(error));
+ }
+
+ void OnCopyFileProgress(int64 size) {}
+
+ base::WeakPtr<EventLogger> GetWeakPtr() {
+ return weak_ptr_factory_.GetWeakPtr();
+ }
+
+ base::File::Error* error() { return error_.get(); }
+
+ private:
+ scoped_ptr<base::File::Error> error_;
+ base::WeakPtrFactory<EventLogger> weak_ptr_factory_;
+
+ DISALLOW_COPY_AND_ASSIGN(EventLogger);
+};
+
+// Registers an external mount point, and removes it once the object gets out
+// of scope. To ensure that creating the mount point succeeded, call is_valid().
+class ScopedExternalMountPoint {
+ public:
+ ScopedExternalMountPoint(const std::string& mount_point_name,
+ const base::FilePath& mount_path,
+ fileapi::FileSystemType type)
+ : mount_point_name_(mount_point_name) {
+ fileapi::ExternalMountPoints* const mount_points =
+ fileapi::ExternalMountPoints::GetSystemInstance();
+ DCHECK(mount_points);
+ is_valid_ =
+ mount_points->RegisterFileSystem(mount_point_name,
+ fileapi::kFileSystemTypeProvided,
+ fileapi::FileSystemMountOption(),
+ mount_path);
+ }
+
+ virtual ~ScopedExternalMountPoint() {
+ if (!is_valid_)
+ return;
+
+ // If successfully registered in the constructor, then unregister.
+ fileapi::ExternalMountPoints* const mount_points =
+ fileapi::ExternalMountPoints::GetSystemInstance();
+ DCHECK(mount_points);
+ mount_points->RevokeFileSystem(mount_point_name_);
+ }
+
+ bool is_valid() { return is_valid_; }
+
+ private:
+ const std::string mount_point_name_;
+ bool is_valid_;
+};
+
+// Creates a cracked FileSystemURL for tests.
+fileapi::FileSystemURL CreateFileSystemURL(const std::string& mount_point_name,
+ const base::FilePath& file_path) {
+ const std::string origin = std::string("chrome-extension://") + kExtensionId;
+ const fileapi::ExternalMountPoints* const mount_points =
+ fileapi::ExternalMountPoints::GetSystemInstance();
+ return mount_points->CreateCrackedFileSystemURL(
+ GURL(origin),
+ fileapi::kFileSystemTypeExternal,
+ base::FilePath::FromUTF8Unsafe(mount_point_name).Append(file_path));
+}
+
+} // namespace
+
+// Tests in this file are very lightweight and just test integration between
+// AsyncFileUtil and ProvideFileSystemInterface. Currently it tests if not
+// implemented operations return a correct error code. For not allowed
+// operations it is FILE_ERROR_SECURITY, and for not implemented the error is
+// FILE_ERROR_NOT_FOUND.
+class FileSystemProviderProviderAsyncFileUtilTest : public testing::Test {
+ protected:
+ FileSystemProviderProviderAsyncFileUtilTest() {}
+ virtual ~FileSystemProviderProviderAsyncFileUtilTest() {}
+
+ virtual void SetUp() OVERRIDE {
+ ASSERT_TRUE(data_dir_.CreateUniqueTempDir());
+ profile_.reset(new TestingProfile);
+ async_file_util_.reset(new internal::ProviderAsyncFileUtil);
+ const base::FilePath mount_path =
+ util::GetMountPointPath(profile_.get(), kExtensionId, kFileSystemId);
+ file_system_context_ =
+ content::CreateFileSystemContextForTesting(NULL, data_dir_.path());
+
+ const std::string mount_point_name = mount_path.BaseName().AsUTF8Unsafe();
+ mount_point_.reset(new ScopedExternalMountPoint(
+ mount_point_name, mount_path, fileapi::kFileSystemTypeProvided));
+ ASSERT_TRUE(mount_point_->is_valid());
+
+ file_url_ = CreateFileSystemURL(
+ mount_point_name, base::FilePath::FromUTF8Unsafe("hello/world.txt"));
+ ASSERT_TRUE(file_url_.is_valid());
+ directory_url_ = CreateFileSystemURL(
+ mount_point_name, base::FilePath::FromUTF8Unsafe("hello"));
+ ASSERT_TRUE(directory_url_.is_valid());
+ root_url_ = CreateFileSystemURL(mount_point_name, base::FilePath());
+ ASSERT_TRUE(root_url_.is_valid());
+ }
+
+ scoped_ptr<fileapi::FileSystemOperationContext> CreateOperationContext() {
+ return make_scoped_ptr(
+ new fileapi::FileSystemOperationContext(file_system_context_.get()));
+ }
+
+ content::TestBrowserThreadBundle thread_bundle_;
+ base::ScopedTempDir data_dir_;
+ scoped_ptr<TestingProfile> profile_;
+ scoped_ptr<fileapi::AsyncFileUtil> async_file_util_;
+ scoped_refptr<fileapi::FileSystemContext> file_system_context_;
+ scoped_ptr<ScopedExternalMountPoint> mount_point_;
+ fileapi::FileSystemURL file_url_;
+ fileapi::FileSystemURL directory_url_;
+ fileapi::FileSystemURL root_url_;
+};
+
+TEST_F(FileSystemProviderProviderAsyncFileUtilTest, CreateOrOpen_Create) {
+ EventLogger logger;
+
+ async_file_util_->CreateOrOpen(
+ CreateOperationContext(),
+ file_url_,
+ base::PLATFORM_FILE_CREATE,
+ base::Bind(&EventLogger::OnCreateOrOpen, logger.GetWeakPtr()));
+
+ ASSERT_TRUE(logger.error());
+ EXPECT_EQ(base::File::FILE_ERROR_SECURITY, *logger.error());
+}
+
+TEST_F(FileSystemProviderProviderAsyncFileUtilTest, CreateOrOpen_CreateAlways) {
+ EventLogger logger;
+
+ async_file_util_->CreateOrOpen(
+ CreateOperationContext(),
+ file_url_,
+ base::PLATFORM_FILE_CREATE_ALWAYS,
+ base::Bind(&EventLogger::OnCreateOrOpen, logger.GetWeakPtr()));
+
+ ASSERT_TRUE(logger.error());
+ EXPECT_EQ(base::File::FILE_ERROR_SECURITY, *logger.error());
+}
+
+TEST_F(FileSystemProviderProviderAsyncFileUtilTest, CreateOrOpen_OpenAlways) {
+ EventLogger logger;
+
+ async_file_util_->CreateOrOpen(
+ CreateOperationContext(),
+ file_url_,
+ base::PLATFORM_FILE_OPEN_ALWAYS,
+ base::Bind(&EventLogger::OnCreateOrOpen, logger.GetWeakPtr()));
+
+ ASSERT_TRUE(logger.error());
+ EXPECT_EQ(base::File::FILE_ERROR_SECURITY, *logger.error());
+}
+
+TEST_F(FileSystemProviderProviderAsyncFileUtilTest,
+ CreateOrOpen_OpenTruncated) {
+ EventLogger logger;
+
+ async_file_util_->CreateOrOpen(
+ CreateOperationContext(),
+ file_url_,
+ base::PLATFORM_FILE_OPEN_TRUNCATED,
+ base::Bind(&EventLogger::OnCreateOrOpen, logger.GetWeakPtr()));
+
+ ASSERT_TRUE(logger.error());
+ EXPECT_EQ(base::File::FILE_ERROR_SECURITY, *logger.error());
+}
+
+TEST_F(FileSystemProviderProviderAsyncFileUtilTest, CreateOrOpen_Open) {
+ EventLogger logger;
+
+ async_file_util_->CreateOrOpen(
+ CreateOperationContext(),
+ file_url_,
+ base::PLATFORM_FILE_OPEN,
+ base::Bind(&EventLogger::OnCreateOrOpen, logger.GetWeakPtr()));
+
+ ASSERT_TRUE(logger.error());
+ EXPECT_EQ(base::File::FILE_ERROR_NOT_FOUND, *logger.error());
+}
+
+TEST_F(FileSystemProviderProviderAsyncFileUtilTest, EnsureFileExists) {
+ EventLogger logger;
+
+ async_file_util_->EnsureFileExists(
+ CreateOperationContext(),
+ file_url_,
+ base::Bind(&EventLogger::OnEnsureFileExists, logger.GetWeakPtr()));
+
+ ASSERT_TRUE(logger.error());
+ EXPECT_EQ(base::File::FILE_ERROR_SECURITY, *logger.error());
+}
+
+TEST_F(FileSystemProviderProviderAsyncFileUtilTest, CreateDirectory) {
+ EventLogger logger;
+
+ async_file_util_->CreateDirectory(
+ CreateOperationContext(),
+ directory_url_,
+ false, // exclusive
+ false, // recursive
+ base::Bind(&EventLogger::OnStatus, logger.GetWeakPtr()));
+
+ ASSERT_TRUE(logger.error());
+ EXPECT_EQ(base::File::FILE_ERROR_SECURITY, *logger.error());
+}
+
+TEST_F(FileSystemProviderProviderAsyncFileUtilTest, GetFileInfo) {
+ EventLogger logger;
+
+ async_file_util_->GetFileInfo(
+ CreateOperationContext(),
+ file_url_,
+ base::Bind(&EventLogger::OnGetFileInfo, logger.GetWeakPtr()));
+
+ ASSERT_TRUE(logger.error());
+ EXPECT_EQ(base::File::FILE_ERROR_NOT_FOUND, *logger.error());
+}
+
+TEST_F(FileSystemProviderProviderAsyncFileUtilTest, ReadDirectory) {
+ EventLogger logger;
+
+ async_file_util_->ReadDirectory(
+ CreateOperationContext(),
+ root_url_,
+ base::Bind(&EventLogger::OnReadDirectory, logger.GetWeakPtr()));
+
+ ASSERT_TRUE(logger.error());
+ EXPECT_EQ(base::File::FILE_ERROR_NOT_FOUND, *logger.error());
+}
+
+TEST_F(FileSystemProviderProviderAsyncFileUtilTest, Touch) {
+ EventLogger logger;
+
+ async_file_util_->CreateDirectory(
+ CreateOperationContext(),
+ file_url_,
+ false, // exclusive
+ false, // recursive
+ base::Bind(&EventLogger::OnStatus, logger.GetWeakPtr()));
+
+ ASSERT_TRUE(logger.error());
+ EXPECT_EQ(base::File::FILE_ERROR_SECURITY, *logger.error());
+}
+
+TEST_F(FileSystemProviderProviderAsyncFileUtilTest, Truncate) {
+ EventLogger logger;
+
+ async_file_util_->Truncate(
+ CreateOperationContext(),
+ file_url_,
+ 0, // length
+ base::Bind(&EventLogger::OnStatus, logger.GetWeakPtr()));
+
+ ASSERT_TRUE(logger.error());
+ EXPECT_EQ(base::File::FILE_ERROR_SECURITY, *logger.error());
+}
+
+TEST_F(FileSystemProviderProviderAsyncFileUtilTest, CopyFileLocal) {
+ EventLogger logger;
+
+ async_file_util_->CopyFileLocal(
+ CreateOperationContext(),
+ file_url_, // src_url
+ file_url_, // dst_url
+ fileapi::FileSystemOperation::OPTION_NONE,
+ base::Bind(&EventLogger::OnCopyFileProgress, logger.GetWeakPtr()),
+ base::Bind(&EventLogger::OnStatus, logger.GetWeakPtr()));
+
+ ASSERT_TRUE(logger.error());
+ EXPECT_EQ(base::File::FILE_ERROR_SECURITY, *logger.error());
+}
+
+TEST_F(FileSystemProviderProviderAsyncFileUtilTest, MoveFileLocal) {
+ EventLogger logger;
+
+ async_file_util_->MoveFileLocal(
+ CreateOperationContext(),
+ file_url_, // src_url
+ file_url_, // dst_url
+ fileapi::FileSystemOperation::OPTION_NONE,
+ base::Bind(&EventLogger::OnStatus, logger.GetWeakPtr()));
+
+ ASSERT_TRUE(logger.error());
+ EXPECT_EQ(base::File::FILE_ERROR_SECURITY, *logger.error());
+}
+
+TEST_F(FileSystemProviderProviderAsyncFileUtilTest, CopyInForeignFile) {
+ EventLogger logger;
+
+ async_file_util_->CopyInForeignFile(
+ CreateOperationContext(),
+ base::FilePath(), // src_file_path
+ file_url_, // dst_url
+ base::Bind(&EventLogger::OnStatus, logger.GetWeakPtr()));
+
+ ASSERT_TRUE(logger.error());
+ EXPECT_EQ(base::File::FILE_ERROR_SECURITY, *logger.error());
+}
+
+TEST_F(FileSystemProviderProviderAsyncFileUtilTest, DeleteFile) {
+ EventLogger logger;
+
+ async_file_util_->DeleteFile(
+ CreateOperationContext(),
+ file_url_,
+ base::Bind(&EventLogger::OnStatus, logger.GetWeakPtr()));
+
+ ASSERT_TRUE(logger.error());
+ EXPECT_EQ(base::File::FILE_ERROR_SECURITY, *logger.error());
+}
+
+TEST_F(FileSystemProviderProviderAsyncFileUtilTest, DeleteDirectory) {
+ EventLogger logger;
+
+ async_file_util_->DeleteDirectory(
+ CreateOperationContext(),
+ directory_url_,
+ base::Bind(&EventLogger::OnStatus, logger.GetWeakPtr()));
+
+ ASSERT_TRUE(logger.error());
+ EXPECT_EQ(base::File::FILE_ERROR_SECURITY, *logger.error());
+}
+
+TEST_F(FileSystemProviderProviderAsyncFileUtilTest, DeleteRecursively) {
+ EventLogger logger;
+
+ async_file_util_->DeleteRecursively(
+ CreateOperationContext(),
+ directory_url_,
+ base::Bind(&EventLogger::OnStatus, logger.GetWeakPtr()));
+
+ ASSERT_TRUE(logger.error());
+ EXPECT_EQ(base::File::FILE_ERROR_SECURITY, *logger.error());
+}
+
+TEST_F(FileSystemProviderProviderAsyncFileUtilTest, CreateSnapshotFile) {
+ EventLogger logger;
+
+ async_file_util_->CreateSnapshotFile(
+ CreateOperationContext(),
+ file_url_,
+ base::Bind(&EventLogger::OnCreateSnapshotFile, logger.GetWeakPtr()));
+
+ ASSERT_TRUE(logger.error());
+ EXPECT_EQ(base::File::FILE_ERROR_NOT_FOUND, *logger.error());
+}
+
+} // namespace file_system_provider
+} // namespace chromeos
diff --git a/chrome/browser/chromeos/fileapi/file_system_backend.cc b/chrome/browser/chromeos/fileapi/file_system_backend.cc
index d2ad6fa..78a5fd8 100644
--- a/chrome/browser/chromeos/fileapi/file_system_backend.cc
+++ b/chrome/browser/chromeos/fileapi/file_system_backend.cc
@@ -37,11 +37,13 @@ bool FileSystemBackend::CanHandleURL(const fileapi::FileSystemURL& url) {
return false;
return url.type() == fileapi::kFileSystemTypeNativeLocal ||
url.type() == fileapi::kFileSystemTypeRestrictedNativeLocal ||
- url.type() == fileapi::kFileSystemTypeDrive;
+ url.type() == fileapi::kFileSystemTypeDrive ||
+ url.type() == fileapi::kFileSystemTypeProvided;
}
FileSystemBackend::FileSystemBackend(
FileSystemBackendDelegate* drive_delegate,
+ FileSystemBackendDelegate* file_system_provider_delegate,
scoped_refptr<quota::SpecialStoragePolicy> special_storage_policy,
scoped_refptr<fileapi::ExternalMountPoints> mount_points,
fileapi::ExternalMountPoints* system_mount_points)
@@ -49,9 +51,9 @@ FileSystemBackend::FileSystemBackend(
file_access_permissions_(new FileAccessPermissions()),
local_file_util_(fileapi::AsyncFileUtil::CreateForLocalFileSystem()),
drive_delegate_(drive_delegate),
+ file_system_provider_delegate_(file_system_provider_delegate),
mount_points_(mount_points),
- system_mount_points_(system_mount_points) {
-}
+ system_mount_points_(system_mount_points) {}
FileSystemBackend::~FileSystemBackend() {
}
@@ -232,6 +234,8 @@ fileapi::AsyncFileUtil* FileSystemBackend::GetAsyncFileUtil(
fileapi::FileSystemType type) {
if (type == fileapi::kFileSystemTypeDrive)
return drive_delegate_->GetAsyncFileUtil(type);
+ if (type == fileapi::kFileSystemTypeProvided)
+ return file_system_provider_delegate_->GetAsyncFileUtil(type);
DCHECK(type == fileapi::kFileSystemTypeNativeLocal ||
type == fileapi::kFileSystemTypeRestrictedNativeLocal);
@@ -286,6 +290,11 @@ FileSystemBackend::CreateFileStreamReader(
url, offset, expected_modification_time, context);
}
+ if (url.type() == fileapi::kFileSystemTypeProvided) {
+ return file_system_provider_delegate_->CreateFileStreamReader(
+ url, offset, expected_modification_time, context);
+ }
+
return scoped_ptr<webkit_blob::FileStreamReader>(
webkit_blob::FileStreamReader::CreateForFileSystemFile(
context, url, offset, expected_modification_time));
@@ -307,6 +316,11 @@ FileSystemBackend::CreateFileStreamWriter(
if (url.type() == fileapi::kFileSystemTypeRestrictedNativeLocal)
return scoped_ptr<fileapi::FileStreamWriter>();
+ if (url.type() == fileapi::kFileSystemTypeProvided) {
+ return file_system_provider_delegate_->CreateFileStreamWriter(
+ url, offset, context);
+ }
+
DCHECK(url.type() == fileapi::kFileSystemTypeNativeLocal);
return scoped_ptr<fileapi::FileStreamWriter>(
fileapi::FileStreamWriter::CreateForLocalFile(
diff --git a/chrome/browser/chromeos/fileapi/file_system_backend.h b/chrome/browser/chromeos/fileapi/file_system_backend.h
index df7bff1..409b36d 100644
--- a/chrome/browser/chromeos/fileapi/file_system_backend.h
+++ b/chrome/browser/chromeos/fileapi/file_system_backend.h
@@ -70,9 +70,11 @@ class FileSystemBackend : public fileapi::ExternalFileSystemBackend {
// FileSystemBackend will take an ownership of a |mount_points|
// reference. On the other hand, |system_mount_points| will be kept as a raw
// pointer and it should outlive FileSystemBackend instance.
- // The ownership of |drive_delegate| is also taken.
+ // The ownerships of |drive_delegate| and |file_system_provider_delegate| are
+ // also taken.
FileSystemBackend(
FileSystemBackendDelegate* drive_delegate,
+ FileSystemBackendDelegate* file_system_provider_delegate,
scoped_refptr<quota::SpecialStoragePolicy> special_storage_policy,
scoped_refptr<fileapi::ExternalMountPoints> mount_points,
fileapi::ExternalMountPoints* system_mount_points);
@@ -135,9 +137,12 @@ class FileSystemBackend : public fileapi::ExternalFileSystemBackend {
scoped_ptr<FileAccessPermissions> file_access_permissions_;
scoped_ptr<fileapi::AsyncFileUtil> local_file_util_;
- // The Delegate instance for the drive file system related operation.
+ // The delegate instance for the drive file system related operations.
scoped_ptr<FileSystemBackendDelegate> drive_delegate_;
+ // The delegate instance for the provided file system related operations.
+ scoped_ptr<FileSystemBackendDelegate> file_system_provider_delegate_;
+
// Mount points specific to the owning context (i.e. per-profile mount
// points).
//
diff --git a/chrome/browser/chromeos/fileapi/file_system_backend_unittest.cc b/chrome/browser/chromeos/fileapi/file_system_backend_unittest.cc
index 2b6b0d8..bb4c747 100644
--- a/chrome/browser/chromeos/fileapi/file_system_backend_unittest.cc
+++ b/chrome/browser/chromeos/fileapi/file_system_backend_unittest.cc
@@ -42,6 +42,7 @@ TEST(ChromeOSFileSystemBackendTest, DefaultMountPoints) {
fileapi::ExternalMountPoints::CreateRefCounted());
chromeos::FileSystemBackend backend(
NULL, // drive_delegate
+ NULL, // file_system_provider_delegate
storage_policy,
mount_points.get(),
fileapi::ExternalMountPoints::GetSystemInstance());
@@ -68,11 +69,11 @@ TEST(ChromeOSFileSystemBackendTest, GetRootDirectories) {
scoped_refptr<fileapi::ExternalMountPoints> system_mount_points(
fileapi::ExternalMountPoints::CreateRefCounted());
- chromeos::FileSystemBackend backend(
- NULL, // drive_delegate
- storage_policy,
- mount_points.get(),
- system_mount_points.get());
+ chromeos::FileSystemBackend backend(NULL, // drive_delegate
+ NULL, // file_system_provider_delegate
+ storage_policy,
+ mount_points.get(),
+ system_mount_points.get());
const size_t initial_root_dirs_size = backend.GetRootDirectories().size();
@@ -114,11 +115,11 @@ TEST(ChromeOSFileSystemBackendTest, AccessPermissions) {
fileapi::ExternalMountPoints::CreateRefCounted());
scoped_refptr<fileapi::ExternalMountPoints> system_mount_points(
fileapi::ExternalMountPoints::CreateRefCounted());
- chromeos::FileSystemBackend backend(
- NULL, // drive_delegate
- storage_policy,
- mount_points.get(),
- system_mount_points.get());
+ chromeos::FileSystemBackend backend(NULL, // drive_delegate
+ NULL, // file_system_provider_delegate
+ storage_policy,
+ mount_points.get(),
+ system_mount_points.get());
std::string extension("ddammdhioacbehjngdmkjcjbnfginlla");
@@ -214,11 +215,11 @@ TEST(ChromeOSFileSystemBackendTest, GetVirtualPathConflictWithSystemPoints) {
fileapi::ExternalMountPoints::CreateRefCounted());
scoped_refptr<fileapi::ExternalMountPoints> system_mount_points(
fileapi::ExternalMountPoints::CreateRefCounted());
- chromeos::FileSystemBackend backend(
- NULL, // drive_delegate
- storage_policy,
- mount_points.get(),
- system_mount_points.get());
+ chromeos::FileSystemBackend backend(NULL, // drive_delegate
+ NULL, // file_system_provider_delegate
+ storage_policy,
+ mount_points.get(),
+ system_mount_points.get());
const fileapi::FileSystemType type = fileapi::kFileSystemTypeNativeLocal;
const fileapi::FileSystemMountOption option =
diff --git a/chrome/chrome_browser_chromeos.gypi b/chrome/chrome_browser_chromeos.gypi
index c112a6d..b141348 100644
--- a/chrome/chrome_browser_chromeos.gypi
+++ b/chrome/chrome_browser_chromeos.gypi
@@ -372,6 +372,10 @@
'browser/chromeos/file_manager/volume_manager_observer.h',
'browser/chromeos/file_manager/zip_file_creator.cc',
'browser/chromeos/file_manager/zip_file_creator.h',
+ 'browser/chromeos/file_system_provider/fileapi/backend_delegate.cc',
+ 'browser/chromeos/file_system_provider/fileapi/backend_delegate.h',
+ 'browser/chromeos/file_system_provider/fileapi/provider_async_file_util.cc',
+ 'browser/chromeos/file_system_provider/fileapi/provider_async_file_util.h',
'browser/chromeos/file_system_provider/mount_path_util.cc',
'browser/chromeos/file_system_provider/mount_path_util.h',
'browser/chromeos/file_system_provider/observer.h',
diff --git a/chrome/chrome_tests_unit.gypi b/chrome/chrome_tests_unit.gypi
index 498e3ab..63e0ef6 100644
--- a/chrome/chrome_tests_unit.gypi
+++ b/chrome/chrome_tests_unit.gypi
@@ -710,6 +710,7 @@
'browser/chromeos/file_manager/volume_manager_unittest.cc',
'browser/chromeos/file_system_provider/fake_provided_file_system.cc',
'browser/chromeos/file_system_provider/fake_provided_file_system.h',
+ 'browser/chromeos/file_system_provider/fileapi/provider_async_file_util_unittest.cc',
'browser/chromeos/file_system_provider/mount_path_util_unittest.cc',
'browser/chromeos/file_system_provider/provided_file_system_unittest.cc',
'browser/chromeos/file_system_provider/request_manager_unittest.cc',