Chromium Code Reviews| Index: content/common/fileapi/file_system_dispatcher.cc |
| diff --git a/content/common/fileapi/file_system_dispatcher.cc b/content/common/fileapi/file_system_dispatcher.cc |
| index dc3309e61b7b8ba10b9870231ad79b6892ac3843..7fed779eca2fbd11e3788d78df3784d01cd3cd09 100644 |
| --- a/content/common/fileapi/file_system_dispatcher.cc |
| +++ b/content/common/fileapi/file_system_dispatcher.cc |
| @@ -9,6 +9,37 @@ |
| #include "content/common/child_thread.h" |
| #include "content/common/fileapi/file_system_messages.h" |
| +namespace { |
| + |
| +// Dummy dispatcher used only for issuing a request_id. |
| +class CloseFileDispatcher : public fileapi::FileSystemCallbackDispatcher { |
|
kinuko
2012/06/13 06:38:29
We usually put these dispatchers on the caller's s
kinaba
2012/06/25 11:14:02
Sounds good. I made it into a send-only message.
|
| + public: |
| + virtual void DidSucceed() {} |
| + virtual void DidFail(base::PlatformFileError error_code) {} |
| + |
| + virtual void DidReadMetadata(const base::PlatformFileInfo& file_info, |
| + const FilePath& platform_path) { |
| + NOTREACHED(); |
| + } |
| + virtual void DidReadDirectory( |
| + const std::vector<base::FileUtilProxy::Entry>& entries, |
| + bool has_more) { |
| + NOTREACHED(); |
| + } |
| + virtual void DidOpenFileSystem(const std::string& name, |
| + const GURL& root) { |
| + NOTREACHED(); |
| + } |
| + virtual void DidWrite(int64 bytes, bool complete) { |
| + NOTREACHED(); |
| + } |
| + virtual void DidOpenFile(base::PlatformFile file) { |
| + NOTREACHED(); |
| + } |
| +}; |
| + |
| +} // namespace |
| + |
| FileSystemDispatcher::FileSystemDispatcher() { |
| } |
| @@ -230,6 +261,17 @@ bool FileSystemDispatcher::OpenFile( |
| return true; |
| } |
| +bool FileSystemDispatcher::NotifyCloseFile(const GURL& file_path) { |
| + fileapi::FileSystemCallbackDispatcher* dispatcher = new CloseFileDispatcher; |
| + int request_id = dispatchers_.Add(dispatcher); |
| + if (!ChildThread::current()->Send( |
| + new FileSystemHostMsg_NotifyCloseFile(request_id, file_path))) { |
| + dispatchers_.Remove(request_id); // destroys |dispatcher| |
| + return false; |
| + } |
| + return true; |
| +} |
| + |
| bool FileSystemDispatcher::CreateSnapshotFile( |
| const GURL& blob_url, |
| const GURL& file_path, |