| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "content/common/fileapi/file_system_dispatcher.h" | 5 #include "content/common/fileapi/file_system_dispatcher.h" |
| 6 | 6 |
| 7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
| 8 #include "base/process.h" | 8 #include "base/process.h" |
| 9 #include "content/common/child_thread.h" | 9 #include "content/common/child_thread.h" |
| 10 #include "content/common/fileapi/file_system_messages.h" | 10 #include "content/common/fileapi/file_system_messages.h" |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 int request_id = dispatchers_.Add(dispatcher); | 46 int request_id = dispatchers_.Add(dispatcher); |
| 47 if (!ChildThread::current()->Send(new FileSystemHostMsg_Open( | 47 if (!ChildThread::current()->Send(new FileSystemHostMsg_Open( |
| 48 request_id, origin_url, type, size, create))) { | 48 request_id, origin_url, type, size, create))) { |
| 49 dispatchers_.Remove(request_id); // destroys |dispatcher| | 49 dispatchers_.Remove(request_id); // destroys |dispatcher| |
| 50 return false; | 50 return false; |
| 51 } | 51 } |
| 52 | 52 |
| 53 return true; | 53 return true; |
| 54 } | 54 } |
| 55 | 55 |
| 56 bool FileSystemDispatcher::DeleteFileSystem( |
| 57 const GURL& origin_url, |
| 58 fileapi::FileSystemType type, |
| 59 fileapi::FileSystemCallbackDispatcher* dispatcher) { |
| 60 int request_id = dispatchers_.Add(dispatcher); |
| 61 if (!ChildThread::current()->Send(new FileSystemHostMsg_DeleteFileSystem( |
| 62 request_id, origin_url, type))) { |
| 63 dispatchers_.Remove(request_id); |
| 64 return false; |
| 65 } |
| 66 return true; |
| 67 } |
| 68 |
| 56 bool FileSystemDispatcher::Move( | 69 bool FileSystemDispatcher::Move( |
| 57 const GURL& src_path, | 70 const GURL& src_path, |
| 58 const GURL& dest_path, | 71 const GURL& dest_path, |
| 59 fileapi::FileSystemCallbackDispatcher* dispatcher) { | 72 fileapi::FileSystemCallbackDispatcher* dispatcher) { |
| 60 int request_id = dispatchers_.Add(dispatcher); | 73 int request_id = dispatchers_.Add(dispatcher); |
| 61 if (!ChildThread::current()->Send(new FileSystemHostMsg_Move( | 74 if (!ChildThread::current()->Send(new FileSystemHostMsg_Move( |
| 62 request_id, src_path, dest_path))) { | 75 request_id, src_path, dest_path))) { |
| 63 dispatchers_.Remove(request_id); // destroys |dispatcher| | 76 dispatchers_.Remove(request_id); // destroys |dispatcher| |
| 64 return false; | 77 return false; |
| 65 } | 78 } |
| (...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 309 } | 322 } |
| 310 | 323 |
| 311 void FileSystemDispatcher::OnDidOpenFile( | 324 void FileSystemDispatcher::OnDidOpenFile( |
| 312 int request_id, IPC::PlatformFileForTransit file) { | 325 int request_id, IPC::PlatformFileForTransit file) { |
| 313 fileapi::FileSystemCallbackDispatcher* dispatcher = | 326 fileapi::FileSystemCallbackDispatcher* dispatcher = |
| 314 dispatchers_.Lookup(request_id); | 327 dispatchers_.Lookup(request_id); |
| 315 DCHECK(dispatcher); | 328 DCHECK(dispatcher); |
| 316 dispatcher->DidOpenFile(IPC::PlatformFileForTransitToPlatformFile(file)); | 329 dispatcher->DidOpenFile(IPC::PlatformFileForTransitToPlatformFile(file)); |
| 317 dispatchers_.Remove(request_id); | 330 dispatchers_.Remove(request_id); |
| 318 } | 331 } |
| OLD | NEW |