OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_system_operation.h" | 5 #include "webkit/fileapi/file_system_operation.h" |
6 | 6 |
7 #include "base/time.h" | 7 #include "base/time.h" |
8 #include "net/url_request/url_request_context.h" | 8 #include "net/url_request/url_request_context.h" |
9 #include "webkit/fileapi/file_system_callback_dispatcher.h" | 9 #include "webkit/fileapi/file_system_callback_dispatcher.h" |
10 #include "webkit/fileapi/file_writer_delegate.h" | 10 #include "webkit/fileapi/file_writer_delegate.h" |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 scoped_refptr<URLRequestContext> url_request_context, | 135 scoped_refptr<URLRequestContext> url_request_context, |
136 const FilePath& path, | 136 const FilePath& path, |
137 const GURL& blob_url, | 137 const GURL& blob_url, |
138 int64 offset) { | 138 int64 offset) { |
139 #ifndef NDEBUG | 139 #ifndef NDEBUG |
140 DCHECK(kOperationNone == pending_operation_); | 140 DCHECK(kOperationNone == pending_operation_); |
141 pending_operation_ = kOperationWrite; | 141 pending_operation_ = kOperationWrite; |
142 #endif | 142 #endif |
143 DCHECK(blob_url.is_valid()); | 143 DCHECK(blob_url.is_valid()); |
144 file_writer_delegate_.reset(new FileWriterDelegate(this, offset)); | 144 file_writer_delegate_.reset(new FileWriterDelegate(this, offset)); |
145 blob_request_.reset(new URLRequest(blob_url, file_writer_delegate_.get())); | 145 blob_request_.reset( |
| 146 new net::URLRequest(blob_url, file_writer_delegate_.get())); |
146 blob_request_->set_context(url_request_context); | 147 blob_request_->set_context(url_request_context); |
147 base::FileUtilProxy::CreateOrOpen( | 148 base::FileUtilProxy::CreateOrOpen( |
148 proxy_, | 149 proxy_, |
149 path, | 150 path, |
150 base::PLATFORM_FILE_OPEN | base::PLATFORM_FILE_WRITE | | 151 base::PLATFORM_FILE_OPEN | base::PLATFORM_FILE_WRITE | |
151 base::PLATFORM_FILE_ASYNC, | 152 base::PLATFORM_FILE_ASYNC, |
152 callback_factory_.NewCallback( | 153 callback_factory_.NewCallback( |
153 &FileSystemOperation::OnFileOpenedForWrite)); | 154 &FileSystemOperation::OnFileOpenedForWrite)); |
154 } | 155 } |
155 | 156 |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
303 } | 304 } |
304 | 305 |
305 void FileSystemOperation::DidTouchFile(base::PlatformFileError rv) { | 306 void FileSystemOperation::DidTouchFile(base::PlatformFileError rv) { |
306 if (rv == base::PLATFORM_FILE_OK) | 307 if (rv == base::PLATFORM_FILE_OK) |
307 dispatcher_->DidSucceed(); | 308 dispatcher_->DidSucceed(); |
308 else | 309 else |
309 dispatcher_->DidFail(rv); | 310 dispatcher_->DidFail(rv); |
310 } | 311 } |
311 | 312 |
312 } // namespace fileapi | 313 } // namespace fileapi |
OLD | NEW |