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

Unified Diff: chrome/browser/chromeos/file_system_provider/fake_provided_file_system.cc

Issue 287673004: [fsp] First part of support for reading files. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased. Created 6 years, 7 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/chromeos/file_system_provider/fake_provided_file_system.cc
diff --git a/chrome/browser/chromeos/file_system_provider/fake_provided_file_system.cc b/chrome/browser/chromeos/file_system_provider/fake_provided_file_system.cc
index 1d297cdb44a89f10a25372b41e87894822c644bc..f8fd16eb60df4a659f9e6c6298c00149454f1ef5 100644
--- a/chrome/browser/chromeos/file_system_provider/fake_provided_file_system.cc
+++ b/chrome/browser/chromeos/file_system_provider/fake_provided_file_system.cc
@@ -9,6 +9,7 @@
#include "base/files/file.h"
#include "base/message_loop/message_loop_proxy.h"
#include "extensions/browser/event_router.h"
+#include "net/base/io_buffer.h"
namespace chromeos {
namespace file_system_provider {
@@ -129,6 +130,7 @@ void FakeProvidedFileSystem::OpenFile(const base::FilePath& file_path,
}
const int file_handle = ++last_file_handle_;
+ opened_files_.insert(file_handle);
callback.Run(file_handle, base::File::FILE_OK);
}
@@ -138,12 +140,29 @@ void FakeProvidedFileSystem::CloseFile(
const std::set<int>::iterator opened_file_it =
opened_files_.find(file_handle);
if (opened_file_it == opened_files_.end()) {
- callback.Run(base::File::FILE_ERROR_NOT_FOUND);
+ base::MessageLoopProxy::current()->PostTask(
+ FROM_HERE, base::Bind(callback, base::File::FILE_ERROR_NOT_FOUND));
return;
}
opened_files_.erase(opened_file_it);
- callback.Run(base::File::FILE_OK);
+ base::MessageLoopProxy::current()->PostTask(
+ FROM_HERE, base::Bind(callback, base::File::FILE_OK));
+}
+
+void FakeProvidedFileSystem::ReadFile(
+ int file_handle,
+ net::IOBuffer* buffer,
+ int64 offset,
+ int length,
+ const ProvidedFileSystemInterface::ReadChunkReceivedCallback& callback) {
+ // TODO(mtomasz): Implement together with the FileStreamReader.
+ base::MessageLoopProxy::current()->PostTask(
+ FROM_HERE,
+ base::Bind(callback,
+ 0 /* chunk_length */,
+ false /* has_next */,
+ base::File::FILE_ERROR_SECURITY));
}
const ProvidedFileSystemInfo& FakeProvidedFileSystem::GetFileSystemInfo()

Powered by Google App Engine
This is Rietveld 408576698