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/message_loop/message_loop_proxy.h" | 9 #include "base/message_loop/message_loop_proxy.h" |
10 #include "base/process/process.h" | 10 #include "base/process/process.h" |
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
265 int* request_id_out, | 265 int* request_id_out, |
266 const StatusCallback& callback) { | 266 const StatusCallback& callback) { |
267 int request_id = dispatchers_.Add(CallbackDispatcher::Create(callback)); | 267 int request_id = dispatchers_.Add(CallbackDispatcher::Create(callback)); |
268 ChildThread::current()->Send( | 268 ChildThread::current()->Send( |
269 new FileSystemHostMsg_Truncate(request_id, path, offset)); | 269 new FileSystemHostMsg_Truncate(request_id, path, offset)); |
270 | 270 |
271 if (request_id_out) | 271 if (request_id_out) |
272 *request_id_out = request_id; | 272 *request_id_out = request_id; |
273 } | 273 } |
274 | 274 |
275 void FileSystemDispatcher::Write( | 275 void FileSystemDispatcher::WriteDeprecated( |
276 const GURL& path, | 276 const GURL& path, |
277 const GURL& blob_url, | 277 const GURL& blob_url, |
278 int64 offset, | 278 int64 offset, |
279 int* request_id_out, | 279 int* request_id_out, |
280 const WriteCallback& success_callback, | 280 const WriteCallback& success_callback, |
281 const StatusCallback& error_callback) { | 281 const StatusCallback& error_callback) { |
282 int request_id = dispatchers_.Add( | 282 int request_id = dispatchers_.Add( |
283 CallbackDispatcher::Create(success_callback, error_callback)); | 283 CallbackDispatcher::Create(success_callback, error_callback)); |
284 ChildThread::current()->Send( | 284 ChildThread::current()->Send( |
285 new FileSystemHostMsg_Write(request_id, path, blob_url, offset)); | 285 new FileSystemHostMsg_WriteDeprecated(request_id, path, |
| 286 blob_url, offset)); |
286 | 287 |
287 if (request_id_out) | 288 if (request_id_out) |
288 *request_id_out = request_id; | 289 *request_id_out = request_id; |
| 290 } |
| 291 |
| 292 void FileSystemDispatcher::Write( |
| 293 const GURL& path, |
| 294 const std::string& blob_id, |
| 295 int64 offset, |
| 296 int* request_id_out, |
| 297 const WriteCallback& success_callback, |
| 298 const StatusCallback& error_callback) { |
| 299 int request_id = dispatchers_.Add( |
| 300 CallbackDispatcher::Create(success_callback, error_callback)); |
| 301 ChildThread::current()->Send( |
| 302 new FileSystemHostMsg_Write(request_id, path, blob_id, offset)); |
| 303 |
| 304 if (request_id_out) |
| 305 *request_id_out = request_id; |
289 } | 306 } |
290 | 307 |
291 void FileSystemDispatcher::Cancel( | 308 void FileSystemDispatcher::Cancel( |
292 int request_id_to_cancel, | 309 int request_id_to_cancel, |
293 const StatusCallback& callback) { | 310 const StatusCallback& callback) { |
294 int request_id = dispatchers_.Add(CallbackDispatcher::Create(callback)); | 311 int request_id = dispatchers_.Add(CallbackDispatcher::Create(callback)); |
295 ChildThread::current()->Send(new FileSystemHostMsg_CancelWrite( | 312 ChildThread::current()->Send(new FileSystemHostMsg_CancelWrite( |
296 request_id, request_id_to_cancel)); | 313 request_id, request_id_to_cancel)); |
297 } | 314 } |
298 | 315 |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
403 quota::QuotaLimitType quota_policy) { | 420 quota::QuotaLimitType quota_policy) { |
404 CallbackDispatcher* dispatcher = dispatchers_.Lookup(request_id); | 421 CallbackDispatcher* dispatcher = dispatchers_.Lookup(request_id); |
405 DCHECK(dispatcher); | 422 DCHECK(dispatcher); |
406 dispatcher->DidOpenFile(IPC::PlatformFileForTransitToPlatformFile(file), | 423 dispatcher->DidOpenFile(IPC::PlatformFileForTransitToPlatformFile(file), |
407 file_open_id, | 424 file_open_id, |
408 quota_policy); | 425 quota_policy); |
409 dispatchers_.Remove(request_id); | 426 dispatchers_.Remove(request_id); |
410 } | 427 } |
411 | 428 |
412 } // namespace content | 429 } // namespace content |
OLD | NEW |