| 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/chromeos/fileapi/remote_file_stream_writer.h" | 5 #include "webkit/chromeos/fileapi/remote_file_stream_writer.h" |
| 6 | 6 |
| 7 #include "net/base/io_buffer.h" | 7 #include "net/base/io_buffer.h" |
| 8 #include "net/base/net_errors.h" | 8 #include "net/base/net_errors.h" |
| 9 #include "webkit/blob/local_file_stream_reader.h" | 9 #include "webkit/blob/local_file_stream_reader.h" |
| 10 #include "webkit/blob/shareable_file_reference.h" | 10 #include "webkit/blob/shareable_file_reference.h" |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 return net::ERR_IO_PENDING; | 49 return net::ERR_IO_PENDING; |
| 50 } | 50 } |
| 51 return local_file_writer_->Write(buf, buf_len, callback); | 51 return local_file_writer_->Write(buf, buf_len, callback); |
| 52 } | 52 } |
| 53 | 53 |
| 54 void RemoteFileStreamWriter::OnFileOpened( | 54 void RemoteFileStreamWriter::OnFileOpened( |
| 55 net::IOBuffer* buf, | 55 net::IOBuffer* buf, |
| 56 int buf_len, | 56 int buf_len, |
| 57 const net::CompletionCallback& callback, | 57 const net::CompletionCallback& callback, |
| 58 base::PlatformFileError open_result, | 58 base::PlatformFileError open_result, |
| 59 const FilePath& local_path, | 59 const base::FilePath& local_path, |
| 60 const scoped_refptr<webkit_blob::ShareableFileReference>& file_ref) { | 60 const scoped_refptr<webkit_blob::ShareableFileReference>& file_ref) { |
| 61 has_pending_create_snapshot_ = false; | 61 has_pending_create_snapshot_ = false; |
| 62 if (!pending_cancel_callback_.is_null()) { | 62 if (!pending_cancel_callback_.is_null()) { |
| 63 InvokePendingCancelCallback(net::OK); | 63 InvokePendingCancelCallback(net::OK); |
| 64 return; | 64 return; |
| 65 } | 65 } |
| 66 | 66 |
| 67 if (open_result != base::PLATFORM_FILE_OK) { | 67 if (open_result != base::PLATFORM_FILE_OK) { |
| 68 callback.Run(net::PlatformFileErrorToNetError(open_result)); | 68 callback.Run(net::PlatformFileErrorToNetError(open_result)); |
| 69 return; | 69 return; |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 return net::OK; | 110 return net::OK; |
| 111 } | 111 } |
| 112 | 112 |
| 113 void RemoteFileStreamWriter::InvokePendingCancelCallback(int result) { | 113 void RemoteFileStreamWriter::InvokePendingCancelCallback(int result) { |
| 114 net::CompletionCallback callback = pending_cancel_callback_; | 114 net::CompletionCallback callback = pending_cancel_callback_; |
| 115 pending_cancel_callback_.Reset(); | 115 pending_cancel_callback_.Reset(); |
| 116 callback.Run(result); | 116 callback.Run(result); |
| 117 } | 117 } |
| 118 | 118 |
| 119 } // namespace gdata | 119 } // namespace gdata |
| OLD | NEW |