| 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/browser/chromeos/fileapi/remote_file_stream_writer.h" | 5 #include "chrome/browser/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/browser/blob/local_file_stream_reader.h" | 9 #include "webkit/browser/blob/local_file_stream_reader.h" |
| 10 #include "webkit/browser/fileapi/local_file_stream_writer.h" | 10 #include "webkit/browser/fileapi/local_file_stream_writer.h" |
| 11 #include "webkit/browser/fileapi/remote_file_system_proxy.h" | 11 #include "webkit/browser/fileapi/remote_file_system_proxy.h" |
| 12 #include "webkit/common/blob/shareable_file_reference.h" | 12 #include "webkit/common/blob/shareable_file_reference.h" |
| 13 | 13 |
| 14 namespace fileapi { | 14 namespace chromeos { |
| 15 | 15 |
| 16 RemoteFileStreamWriter::RemoteFileStreamWriter( | 16 RemoteFileStreamWriter::RemoteFileStreamWriter( |
| 17 const scoped_refptr<RemoteFileSystemProxyInterface>& remote_filesystem, | 17 const scoped_refptr<fileapi::RemoteFileSystemProxyInterface>& |
| 18 const FileSystemURL& url, | 18 remote_filesystem, |
| 19 const fileapi::FileSystemURL& url, |
| 19 int64 offset, | 20 int64 offset, |
| 20 base::TaskRunner *local_task_runner) | 21 base::TaskRunner *local_task_runner) |
| 21 : remote_filesystem_(remote_filesystem), | 22 : remote_filesystem_(remote_filesystem), |
| 23 local_task_runner_(local_task_runner), |
| 22 url_(url), | 24 url_(url), |
| 23 initial_offset_(offset), | 25 initial_offset_(offset), |
| 24 has_pending_create_snapshot_(false), | 26 has_pending_create_snapshot_(false), |
| 25 weak_factory_(this), | 27 weak_factory_(this) { |
| 26 local_task_runner_(local_task_runner) { | |
| 27 } | 28 } |
| 28 | 29 |
| 29 RemoteFileStreamWriter::~RemoteFileStreamWriter() { | 30 RemoteFileStreamWriter::~RemoteFileStreamWriter() { |
| 30 } | 31 } |
| 31 | 32 |
| 32 int RemoteFileStreamWriter::Write(net::IOBuffer* buf, | 33 int RemoteFileStreamWriter::Write(net::IOBuffer* buf, |
| 33 int buf_len, | 34 int buf_len, |
| 34 const net::CompletionCallback& callback) { | 35 const net::CompletionCallback& callback) { |
| 35 DCHECK(!has_pending_create_snapshot_); | 36 DCHECK(!has_pending_create_snapshot_); |
| 36 DCHECK(pending_cancel_callback_.is_null()); | 37 DCHECK(pending_cancel_callback_.is_null()); |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 // server is not done until the file is closed. | 112 // server is not done until the file is closed. |
| 112 return net::OK; | 113 return net::OK; |
| 113 } | 114 } |
| 114 | 115 |
| 115 void RemoteFileStreamWriter::InvokePendingCancelCallback(int result) { | 116 void RemoteFileStreamWriter::InvokePendingCancelCallback(int result) { |
| 116 net::CompletionCallback callback = pending_cancel_callback_; | 117 net::CompletionCallback callback = pending_cancel_callback_; |
| 117 pending_cancel_callback_.Reset(); | 118 pending_cancel_callback_.Reset(); |
| 118 callback.Run(result); | 119 callback.Run(result); |
| 119 } | 120 } |
| 120 | 121 |
| 121 } // namespace gdata | 122 } // namespace chromeos |
| OLD | NEW |