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/child/fileapi/file_system_dispatcher.h" | 5 #include "content/child/fileapi/file_system_dispatcher.h" |
6 | 6 |
7 #include "base/callback.h" | 7 #include "base/callback.h" |
8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
9 #include "base/process.h" | 9 #include "base/process.h" |
10 #include "content/child/child_thread.h" | 10 #include "content/child/child_thread.h" |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 void FileSystemDispatcher::ReadMetadata( | 211 void FileSystemDispatcher::ReadMetadata( |
212 const GURL& path, | 212 const GURL& path, |
213 const MetadataCallback& success_callback, | 213 const MetadataCallback& success_callback, |
214 const StatusCallback& error_callback) { | 214 const StatusCallback& error_callback) { |
215 int request_id = dispatchers_.Add( | 215 int request_id = dispatchers_.Add( |
216 CallbackDispatcher::Create(success_callback, error_callback)); | 216 CallbackDispatcher::Create(success_callback, error_callback)); |
217 ChildThread::current()->Send( | 217 ChildThread::current()->Send( |
218 new FileSystemHostMsg_ReadMetadata(request_id, path)); | 218 new FileSystemHostMsg_ReadMetadata(request_id, path)); |
219 } | 219 } |
220 | 220 |
221 void FileSystemDispatcher::Create( | 221 void FileSystemDispatcher::CreateFile( |
222 const GURL& path, | 222 const GURL& path, |
223 bool exclusive, | 223 bool exclusive, |
224 bool is_directory, | 224 const StatusCallback& callback) { |
| 225 int request_id = dispatchers_.Add(CallbackDispatcher::Create(callback)); |
| 226 ChildThread::current()->Send(new FileSystemHostMsg_Create( |
| 227 request_id, path, exclusive, |
| 228 false /* is_directory */, false /* recursive */)); |
| 229 } |
| 230 |
| 231 void FileSystemDispatcher::CreateDirectory( |
| 232 const GURL& path, |
| 233 bool exclusive, |
225 bool recursive, | 234 bool recursive, |
226 const StatusCallback& callback) { | 235 const StatusCallback& callback) { |
227 int request_id = dispatchers_.Add(CallbackDispatcher::Create(callback)); | 236 int request_id = dispatchers_.Add(CallbackDispatcher::Create(callback)); |
228 ChildThread::current()->Send(new FileSystemHostMsg_Create( | 237 ChildThread::current()->Send(new FileSystemHostMsg_Create( |
229 request_id, path, exclusive, is_directory, recursive)); | 238 request_id, path, exclusive, true /* is_directory */, recursive)); |
230 } | 239 } |
231 | 240 |
232 void FileSystemDispatcher::Exists( | 241 void FileSystemDispatcher::Exists( |
233 const GURL& path, | 242 const GURL& path, |
234 bool is_directory, | 243 bool is_directory, |
235 const StatusCallback& callback) { | 244 const StatusCallback& callback) { |
236 int request_id = dispatchers_.Add(CallbackDispatcher::Create(callback)); | 245 int request_id = dispatchers_.Add(CallbackDispatcher::Create(callback)); |
237 ChildThread::current()->Send( | 246 ChildThread::current()->Send( |
238 new FileSystemHostMsg_Exists(request_id, path, is_directory)); | 247 new FileSystemHostMsg_Exists(request_id, path, is_directory)); |
239 } | 248 } |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
394 quota::QuotaLimitType quota_policy) { | 403 quota::QuotaLimitType quota_policy) { |
395 CallbackDispatcher* dispatcher = dispatchers_.Lookup(request_id); | 404 CallbackDispatcher* dispatcher = dispatchers_.Lookup(request_id); |
396 DCHECK(dispatcher); | 405 DCHECK(dispatcher); |
397 dispatcher->DidOpenFile(IPC::PlatformFileForTransitToPlatformFile(file), | 406 dispatcher->DidOpenFile(IPC::PlatformFileForTransitToPlatformFile(file), |
398 file_open_id, | 407 file_open_id, |
399 quota_policy); | 408 quota_policy); |
400 dispatchers_.Remove(request_id); | 409 dispatchers_.Remove(request_id); |
401 } | 410 } |
402 | 411 |
403 } // namespace content | 412 } // namespace content |
OLD | NEW |