| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "webkit/browser/fileapi/file_system_operation_impl.h" | 5 #include "webkit/browser/fileapi/file_system_operation_impl.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/single_thread_task_runner.h" | 8 #include "base/single_thread_task_runner.h" |
| 9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
| 10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
| (...skipping 527 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 538 } | 538 } |
| 539 | 539 |
| 540 StatusCallback cancel_callback = cancel_callback_; | 540 StatusCallback cancel_callback = cancel_callback_; |
| 541 write_callback.Run(rv, bytes, complete); | 541 write_callback.Run(rv, bytes, complete); |
| 542 if (!cancel_callback.is_null()) | 542 if (!cancel_callback.is_null()) |
| 543 cancel_callback.Run(base::File::FILE_OK); | 543 cancel_callback.Run(base::File::FILE_OK); |
| 544 } | 544 } |
| 545 | 545 |
| 546 void FileSystemOperationImpl::DidOpenFile( | 546 void FileSystemOperationImpl::DidOpenFile( |
| 547 const OpenFileCallback& callback, | 547 const OpenFileCallback& callback, |
| 548 base::File::Error rv, | 548 base::File file, |
| 549 base::PassPlatformFile file, | |
| 550 const base::Closure& on_close_callback) { | 549 const base::Closure& on_close_callback) { |
| 551 callback.Run(rv, file.ReleaseValue(), on_close_callback); | 550 // TODO(rvargas): Remove PlatformFile from FileSystemOperation. |
| 551 base::File::Error error; |
| 552 base::PlatformFile platform_file; |
| 553 if (file.IsValid()) { |
| 554 error = base::File::FILE_OK; |
| 555 platform_file = file.TakePlatformFile(); |
| 556 } else { |
| 557 error = file.error_details(); |
| 558 platform_file = base::kInvalidPlatformFileValue; |
| 559 } |
| 560 callback.Run(error, platform_file, on_close_callback); |
| 552 } | 561 } |
| 553 | 562 |
| 554 bool FileSystemOperationImpl::SetPendingOperationType(OperationType type) { | 563 bool FileSystemOperationImpl::SetPendingOperationType(OperationType type) { |
| 555 if (pending_operation_ != kOperationNone) | 564 if (pending_operation_ != kOperationNone) |
| 556 return false; | 565 return false; |
| 557 pending_operation_ = type; | 566 pending_operation_ = type; |
| 558 return true; | 567 return true; |
| 559 } | 568 } |
| 560 | 569 |
| 561 } // namespace fileapi | 570 } // namespace fileapi |
| OLD | NEW |