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 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 if (!ChildThread::current()->Send( | 223 if (!ChildThread::current()->Send( |
224 new FileSystemHostMsg_OpenFile( | 224 new FileSystemHostMsg_OpenFile( |
225 request_id, file_path, file_flags))) { | 225 request_id, file_path, file_flags))) { |
226 dispatchers_.Remove(request_id); // destroys |dispatcher| | 226 dispatchers_.Remove(request_id); // destroys |dispatcher| |
227 return false; | 227 return false; |
228 } | 228 } |
229 | 229 |
230 return true; | 230 return true; |
231 } | 231 } |
232 | 232 |
| 233 bool FileSystemDispatcher::NotifyCloseFile(const GURL& file_path) { |
| 234 return ChildThread::current()->Send( |
| 235 new FileSystemHostMsg_NotifyCloseFile(file_path)); |
| 236 } |
| 237 |
233 bool FileSystemDispatcher::CreateSnapshotFile( | 238 bool FileSystemDispatcher::CreateSnapshotFile( |
234 const GURL& blob_url, | 239 const GURL& blob_url, |
235 const GURL& file_path, | 240 const GURL& file_path, |
236 fileapi::FileSystemCallbackDispatcher* dispatcher) { | 241 fileapi::FileSystemCallbackDispatcher* dispatcher) { |
237 int request_id = dispatchers_.Add(dispatcher); | 242 int request_id = dispatchers_.Add(dispatcher); |
238 if (!ChildThread::current()->Send( | 243 if (!ChildThread::current()->Send( |
239 new FileSystemHostMsg_CreateSnapshotFile( | 244 new FileSystemHostMsg_CreateSnapshotFile( |
240 request_id, blob_url, file_path))) { | 245 request_id, blob_url, file_path))) { |
241 dispatchers_.Remove(request_id); // destroys |dispatcher| | 246 dispatchers_.Remove(request_id); // destroys |dispatcher| |
242 return false; | 247 return false; |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
304 } | 309 } |
305 | 310 |
306 void FileSystemDispatcher::OnDidOpenFile( | 311 void FileSystemDispatcher::OnDidOpenFile( |
307 int request_id, IPC::PlatformFileForTransit file) { | 312 int request_id, IPC::PlatformFileForTransit file) { |
308 fileapi::FileSystemCallbackDispatcher* dispatcher = | 313 fileapi::FileSystemCallbackDispatcher* dispatcher = |
309 dispatchers_.Lookup(request_id); | 314 dispatchers_.Lookup(request_id); |
310 DCHECK(dispatcher); | 315 DCHECK(dispatcher); |
311 dispatcher->DidOpenFile(IPC::PlatformFileForTransitToPlatformFile(file)); | 316 dispatcher->DidOpenFile(IPC::PlatformFileForTransitToPlatformFile(file)); |
312 dispatchers_.Remove(request_id); | 317 dispatchers_.Remove(request_id); |
313 } | 318 } |
OLD | NEW |