| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/common/file_system/file_system_dispatcher.h" | 5 #include "chrome/common/file_system/file_system_dispatcher.h" |
| 6 | 6 |
| 7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
| 8 #include "chrome/common/child_thread.h" | 8 #include "chrome/common/child_thread.h" |
| 9 #include "chrome/common/render_messages.h" | 9 #include "chrome/common/render_messages.h" |
| 10 #include "chrome/common/render_messages_params.h" | 10 #include "chrome/common/render_messages_params.h" |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 IPC_MESSAGE_HANDLER(ViewMsg_FileSystem_DidReadMetadata, DidReadMetadata) | 34 IPC_MESSAGE_HANDLER(ViewMsg_FileSystem_DidReadMetadata, DidReadMetadata) |
| 35 IPC_MESSAGE_HANDLER(ViewMsg_FileSystem_DidFail, DidFail) | 35 IPC_MESSAGE_HANDLER(ViewMsg_FileSystem_DidFail, DidFail) |
| 36 IPC_MESSAGE_HANDLER(ViewMsg_FileSystem_DidWrite, DidWrite) | 36 IPC_MESSAGE_HANDLER(ViewMsg_FileSystem_DidWrite, DidWrite) |
| 37 IPC_MESSAGE_UNHANDLED(handled = false) | 37 IPC_MESSAGE_UNHANDLED(handled = false) |
| 38 IPC_END_MESSAGE_MAP() | 38 IPC_END_MESSAGE_MAP() |
| 39 return handled; | 39 return handled; |
| 40 } | 40 } |
| 41 | 41 |
| 42 bool FileSystemDispatcher::OpenFileSystem( | 42 bool FileSystemDispatcher::OpenFileSystem( |
| 43 const GURL& origin_url, fileapi::FileSystemType type, | 43 const GURL& origin_url, fileapi::FileSystemType type, |
| 44 long long size, fileapi::FileSystemCallbackDispatcher* dispatcher) { | 44 long long size, bool create, |
| 45 fileapi::FileSystemCallbackDispatcher* dispatcher) { |
| 45 int request_id = dispatchers_.Add(dispatcher); | 46 int request_id = dispatchers_.Add(dispatcher); |
| 46 if (!ChildThread::current()->Send(new ViewHostMsg_OpenFileSystemRequest( | 47 if (!ChildThread::current()->Send(new ViewHostMsg_OpenFileSystemRequest( |
| 47 request_id, origin_url, type, size))) { | 48 request_id, origin_url, type, size, create))) { |
| 48 dispatchers_.Remove(request_id); // destroys |dispatcher| | 49 dispatchers_.Remove(request_id); // destroys |dispatcher| |
| 49 return false; | 50 return false; |
| 50 } | 51 } |
| 51 | 52 |
| 52 return true; | 53 return true; |
| 53 } | 54 } |
| 54 | 55 |
| 55 bool FileSystemDispatcher::Move( | 56 bool FileSystemDispatcher::Move( |
| 56 const FilePath& src_path, | 57 const FilePath& src_path, |
| 57 const FilePath& dest_path, | 58 const FilePath& dest_path, |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 267 | 268 |
| 268 void FileSystemDispatcher::DidWrite( | 269 void FileSystemDispatcher::DidWrite( |
| 269 int request_id, int64 bytes, bool complete) { | 270 int request_id, int64 bytes, bool complete) { |
| 270 fileapi::FileSystemCallbackDispatcher* dispatcher = | 271 fileapi::FileSystemCallbackDispatcher* dispatcher = |
| 271 dispatchers_.Lookup(request_id); | 272 dispatchers_.Lookup(request_id); |
| 272 DCHECK(dispatcher); | 273 DCHECK(dispatcher); |
| 273 dispatcher->DidWrite(bytes, complete); | 274 dispatcher->DidWrite(bytes, complete); |
| 274 if (complete) | 275 if (complete) |
| 275 dispatchers_.Remove(request_id); | 276 dispatchers_.Remove(request_id); |
| 276 } | 277 } |
| OLD | NEW |