| Index: chrome/browser/local_discovery/storage/privet_filesystem_async_util.cc
|
| diff --git a/chrome/browser/local_discovery/storage/privet_filesystem_async_util.cc b/chrome/browser/local_discovery/storage/privet_filesystem_async_util.cc
|
| index c010b21ecf2583997ca4d4e2d2bcec87a7c43fb8..a6459741df8bfde61bc842ccebfd1647fb69ca33 100644
|
| --- a/chrome/browser/local_discovery/storage/privet_filesystem_async_util.cc
|
| +++ b/chrome/browser/local_discovery/storage/privet_filesystem_async_util.cc
|
| @@ -5,11 +5,20 @@
|
| #include "chrome/browser/local_discovery/storage/privet_filesystem_async_util.h"
|
|
|
| #include "base/platform_file.h"
|
| +#include "base/stl_util.h"
|
| #include "webkit/browser/fileapi/file_system_url.h"
|
| #include "webkit/common/blob/shareable_file_reference.h"
|
|
|
| namespace local_discovery {
|
|
|
| +PrivetFileSystemAsyncUtil::PrivetFileSystemAsyncUtil(
|
| + content::BrowserContext* browser_context)
|
| + : browser_context_(browser_context) {
|
| +}
|
| +
|
| +PrivetFileSystemAsyncUtil::~PrivetFileSystemAsyncUtil() {
|
| +}
|
| +
|
| void PrivetFileSystemAsyncUtil::CreateOrOpen(
|
| scoped_ptr<fileapi::FileSystemOperationContext> context,
|
| const fileapi::FileSystemURL& url,
|
| @@ -45,15 +54,10 @@ void PrivetFileSystemAsyncUtil::GetFileInfo(
|
| const GetFileInfoCallback& callback) {
|
| base::File::Info file_info;
|
|
|
| - if (url.path() == base::FilePath(FILE_PATH_LITERAL("/privet"))) {
|
| - file_info.size = 20;
|
| - file_info.is_directory = true;
|
| - file_info.is_symbolic_link = false;
|
| - } else {
|
| - file_info.size = 3000;
|
| - file_info.is_directory = false;
|
| - file_info.is_symbolic_link = false;
|
| - }
|
| + file_info.size = 20;
|
| + file_info.is_directory = true;
|
| + file_info.is_symbolic_link = false;
|
| +
|
| callback.Run(base::File::FILE_OK, file_info);
|
| }
|
|
|
| @@ -61,17 +65,16 @@ void PrivetFileSystemAsyncUtil::ReadDirectory(
|
| scoped_ptr<fileapi::FileSystemOperationContext> context,
|
| const fileapi::FileSystemURL& url,
|
| const ReadDirectoryCallback& callback) {
|
| - EntryList entry_list;
|
| -
|
| - fileapi::DirectoryEntry entry("Random file",
|
| - fileapi::DirectoryEntry::FILE,
|
| - 3000,
|
| - base::Time());
|
| - entry_list.push_back(entry);
|
| -
|
| - callback.Run(base::File::FILE_OK, entry_list, false);
|
| + PrivetFileSystemAsyncOperation* operation = new PrivetFileSystemListOperation(
|
| + url.path(),
|
| + browser_context_,
|
| + this,
|
| + callback);
|
| + async_operations_.insert(operation);
|
| + operation->Start();
|
| }
|
|
|
| +
|
| void PrivetFileSystemAsyncUtil::Touch(
|
| scoped_ptr<fileapi::FileSystemOperationContext> context,
|
| const fileapi::FileSystemURL& url,
|
| @@ -156,4 +159,14 @@ void PrivetFileSystemAsyncUtil::CreateSnapshotFile(
|
| scoped_refptr<webkit_blob::ShareableFileReference>());
|
| }
|
|
|
| +void PrivetFileSystemAsyncUtil::RemoveOperation(
|
| + PrivetFileSystemAsyncOperation* operation) {
|
| + async_operations_.erase(operation);
|
| + delete operation;
|
| +}
|
| +
|
| +void PrivetFileSystemAsyncUtil::RemoveAllOperations() {
|
| + STLDeleteElements(&async_operations_);
|
| +}
|
| +
|
| } // namespace local_discovery
|
|
|