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

Unified Diff: chrome/browser/file_system/file_system_dispatcher_host.cc

Issue 3440021: This is the IPC and bits of the browser backend for FileWriter. The rest of... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 3 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
« no previous file with comments | « chrome/browser/file_system/file_system_dispatcher_host.h ('k') | chrome/common/render_messages_internal.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/file_system/file_system_dispatcher_host.cc
===================================================================
--- chrome/browser/file_system/file_system_dispatcher_host.cc (revision 60387)
+++ chrome/browser/file_system/file_system_dispatcher_host.cc (working copy)
@@ -115,6 +115,9 @@
IPC_MESSAGE_HANDLER(ViewHostMsg_FileSystem_Create, OnCreate)
IPC_MESSAGE_HANDLER(ViewHostMsg_FileSystem_Exists, OnExists)
IPC_MESSAGE_HANDLER(ViewHostMsg_FileSystem_ReadDirectory, OnReadDirectory)
+ IPC_MESSAGE_HANDLER(ViewHostMsg_FileSystem_Write, OnWrite)
+ IPC_MESSAGE_HANDLER(ViewHostMsg_FileSystem_Truncate, OnTruncate)
+ IPC_MESSAGE_HANDLER(ViewHostMsg_FileSystem_CancelWrite, OnCancel)
IPC_MESSAGE_UNHANDLED(handled = false)
IPC_END_MESSAGE_MAP_EX()
return handled;
@@ -206,6 +209,39 @@
GetNewOperation(request_id)->ReadDirectory(path);
}
+void FileSystemDispatcherHost::OnWrite(
+ int request_id,
+ const FilePath& path,
+ const GURL& blob_url,
+ int64 offset) {
+ if (!CheckValidFileSystemPath(path, request_id))
+ return;
+ GetNewOperation(request_id)->Write(path, blob_url, offset);
+}
+
+void FileSystemDispatcherHost::OnTruncate(
+ int request_id,
+ const FilePath& path,
+ int64 length) {
+ if (!CheckValidFileSystemPath(path, request_id))
+ return;
+ GetNewOperation(request_id)->Truncate(path, length);
+}
+
+void FileSystemDispatcherHost::OnCancel(
+ int request_id,
+ int request_id_to_cancel) {
+ fileapi::FileSystemOperation* write =
+ operations_.Lookup(request_id_to_cancel);
+ if (write) {
+ write->Cancel();
+ Send(new ViewMsg_FileSystem_DidSucceed(request_id));
+ } else {
+ Send(new ViewMsg_FileSystem_DidFail(
+ request_id, base::PLATFORM_FILE_ERROR_INVALID_OPERATION));
+ }
+}
+
void FileSystemDispatcherHost::Send(IPC::Message* message) {
DCHECK(ChromeThread::CurrentlyOn(ChromeThread::IO));
if (!shutdown_ && message_sender_)
« no previous file with comments | « chrome/browser/file_system/file_system_dispatcher_host.h ('k') | chrome/common/render_messages_internal.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698