Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2432)

Unified Diff: chrome/browser/local_discovery/storage/privet_filesystem_async_util.cc

Issue 141703022: Support for file listing in privet local filesystem (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 1c336b9dd25347e472d563be1319ae5691fa1281..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,
@@ -56,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,
@@ -151,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

Powered by Google App Engine
This is Rietveld 408576698