| 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_system_operation.h" | 5 #include "webkit/chromeos/fileapi/remote_file_system_operation.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
| 9 #include "base/platform_file.h" | 9 #include "base/platform_file.h" |
| 10 #include "base/values.h" | 10 #include "base/values.h" |
| 11 #include "googleurl/src/gurl.h" | 11 #include "googleurl/src/gurl.h" |
| 12 #include "net/url_request/url_request_context.h" |
| 12 #include "webkit/chromeos/fileapi/remote_file_stream_writer.h" | 13 #include "webkit/chromeos/fileapi/remote_file_stream_writer.h" |
| 13 #include "webkit/fileapi/file_system_callback_dispatcher.h" | 14 #include "webkit/fileapi/file_system_callback_dispatcher.h" |
| 14 #include "webkit/fileapi/file_system_url.h" | 15 #include "webkit/fileapi/file_system_url.h" |
| 15 #include "webkit/fileapi/file_writer_delegate.h" | 16 #include "webkit/fileapi/file_writer_delegate.h" |
| 16 | 17 |
| 17 using fileapi::FileSystemURL; | 18 using fileapi::FileSystemURL; |
| 18 | 19 |
| 19 namespace chromeos { | 20 namespace chromeos { |
| 20 | 21 |
| 21 RemoteFileSystemOperation::RemoteFileSystemOperation( | 22 RemoteFileSystemOperation::RemoteFileSystemOperation( |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 file_writer_delegate_.reset( | 120 file_writer_delegate_.reset( |
| 120 new fileapi::FileWriterDelegate( | 121 new fileapi::FileWriterDelegate( |
| 121 base::Bind(&RemoteFileSystemOperation::DidWrite, | 122 base::Bind(&RemoteFileSystemOperation::DidWrite, |
| 122 // FileWriterDelegate is owned by |this|. So Unretained. | 123 // FileWriterDelegate is owned by |this|. So Unretained. |
| 123 base::Unretained(this)), | 124 base::Unretained(this)), |
| 124 scoped_ptr<fileapi::FileStreamWriter>( | 125 scoped_ptr<fileapi::FileStreamWriter>( |
| 125 new fileapi::RemoteFileStreamWriter(remote_proxy_, | 126 new fileapi::RemoteFileStreamWriter(remote_proxy_, |
| 126 url, | 127 url, |
| 127 offset)))); | 128 offset)))); |
| 128 | 129 |
| 129 scoped_ptr<net::URLRequest> blob_request(new net::URLRequest( | 130 scoped_ptr<net::URLRequest> blob_request(url_request_context->CreateRequest( |
| 130 blob_url, file_writer_delegate_.get(), url_request_context)); | 131 blob_url, file_writer_delegate_.get())); |
| 131 | 132 |
| 132 file_writer_delegate_->Start(blob_request.Pass()); | 133 file_writer_delegate_->Start(blob_request.Pass()); |
| 133 } | 134 } |
| 134 | 135 |
| 135 void RemoteFileSystemOperation::Truncate(const FileSystemURL& url, | 136 void RemoteFileSystemOperation::Truncate(const FileSystemURL& url, |
| 136 int64 length, | 137 int64 length, |
| 137 const StatusCallback& callback) { | 138 const StatusCallback& callback) { |
| 138 DCHECK(SetPendingOperationType(kOperationTruncate)); | 139 DCHECK(SetPendingOperationType(kOperationTruncate)); |
| 139 | 140 |
| 140 remote_proxy_->Truncate(url, length, | 141 remote_proxy_->Truncate(url, length, |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 314 | 315 |
| 315 void RemoteFileSystemOperation::DidOpenFile( | 316 void RemoteFileSystemOperation::DidOpenFile( |
| 316 const OpenFileCallback& callback, | 317 const OpenFileCallback& callback, |
| 317 base::PlatformFileError result, | 318 base::PlatformFileError result, |
| 318 base::PlatformFile file, | 319 base::PlatformFile file, |
| 319 base::ProcessHandle peer_handle) { | 320 base::ProcessHandle peer_handle) { |
| 320 callback.Run(result, file, peer_handle); | 321 callback.Run(result, file, peer_handle); |
| 321 } | 322 } |
| 322 | 323 |
| 323 } // namespace chromeos | 324 } // namespace chromeos |
| OLD | NEW |