| 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 "webkit/fileapi/file_writer_delegate.h" | 5 #include "webkit/fileapi/file_writer_delegate.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/file_util_proxy.h" | 9 #include "base/file_util_proxy.h" |
| 10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 case net::ERR_ACCESS_DENIED: | 31 case net::ERR_ACCESS_DENIED: |
| 32 return base::PLATFORM_FILE_ERROR_ACCESS_DENIED; | 32 return base::PLATFORM_FILE_ERROR_ACCESS_DENIED; |
| 33 default: | 33 default: |
| 34 return base::PLATFORM_FILE_ERROR_FAILED; | 34 return base::PLATFORM_FILE_ERROR_FAILED; |
| 35 } | 35 } |
| 36 } | 36 } |
| 37 | 37 |
| 38 } // namespace | 38 } // namespace |
| 39 | 39 |
| 40 FileWriterDelegate::FileWriterDelegate( | 40 FileWriterDelegate::FileWriterDelegate( |
| 41 const FileSystemOperationInterface::WriteCallback& write_callback, | 41 const FileSystemOperation::WriteCallback& write_callback, |
| 42 scoped_ptr<FileStreamWriter> file_stream_writer) | 42 scoped_ptr<FileStreamWriter> file_stream_writer) |
| 43 : write_callback_(write_callback), | 43 : write_callback_(write_callback), |
| 44 file_stream_writer_(file_stream_writer.Pass()), | 44 file_stream_writer_(file_stream_writer.Pass()), |
| 45 bytes_written_backlog_(0), | 45 bytes_written_backlog_(0), |
| 46 bytes_written_(0), | 46 bytes_written_(0), |
| 47 bytes_read_(0), | 47 bytes_read_(0), |
| 48 io_buffer_(new net::IOBufferWithSize(kReadBufSize)), | 48 io_buffer_(new net::IOBufferWithSize(kReadBufSize)), |
| 49 ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)) { | 49 ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)) { |
| 50 } | 50 } |
| 51 | 51 |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 return; | 198 return; |
| 199 } | 199 } |
| 200 bytes_written_backlog_ += bytes_written; | 200 bytes_written_backlog_ += bytes_written; |
| 201 } | 201 } |
| 202 | 202 |
| 203 void FileWriterDelegate::OnWriteCancelled(int status) { | 203 void FileWriterDelegate::OnWriteCancelled(int status) { |
| 204 write_callback_.Run(base::PLATFORM_FILE_ERROR_ABORT, 0, true); | 204 write_callback_.Run(base::PLATFORM_FILE_ERROR_ABORT, 0, true); |
| 205 } | 205 } |
| 206 | 206 |
| 207 } // namespace fileapi | 207 } // namespace fileapi |
| OLD | NEW |