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 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 scoped_refptr<URLRequestContext> url_request_context, | 134 scoped_refptr<URLRequestContext> url_request_context, |
135 const FilePath& path, | 135 const FilePath& path, |
136 const GURL& blob_url, | 136 const GURL& blob_url, |
137 int64 offset) { | 137 int64 offset) { |
138 #ifndef NDEBUG | 138 #ifndef NDEBUG |
139 DCHECK(kOperationNone == pending_operation_); | 139 DCHECK(kOperationNone == pending_operation_); |
140 pending_operation_ = kOperationWrite; | 140 pending_operation_ = kOperationWrite; |
141 #endif | 141 #endif |
142 DCHECK(blob_url.is_valid()); | 142 DCHECK(blob_url.is_valid()); |
143 file_writer_delegate_.reset(new FileWriterDelegate(this, offset)); | 143 file_writer_delegate_.reset(new FileWriterDelegate(this, offset)); |
144 blob_request_.reset(new URLRequest(blob_url, file_writer_delegate_.get())); | 144 blob_request_.reset( |
| 145 new net::URLRequest(blob_url, file_writer_delegate_.get())); |
145 blob_request_->set_context(url_request_context); | 146 blob_request_->set_context(url_request_context); |
146 base::FileUtilProxy::CreateOrOpen( | 147 base::FileUtilProxy::CreateOrOpen( |
147 proxy_, | 148 proxy_, |
148 path, | 149 path, |
149 base::PLATFORM_FILE_OPEN | base::PLATFORM_FILE_WRITE | | 150 base::PLATFORM_FILE_OPEN | base::PLATFORM_FILE_WRITE | |
150 base::PLATFORM_FILE_ASYNC, | 151 base::PLATFORM_FILE_ASYNC, |
151 callback_factory_.NewCallback( | 152 callback_factory_.NewCallback( |
152 &FileSystemOperation::OnFileOpenedForWrite)); | 153 &FileSystemOperation::OnFileOpenedForWrite)); |
153 } | 154 } |
154 | 155 |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
313 | 314 |
314 void FileSystemOperation::DidTouchFile(base::PlatformFileError rv) { | 315 void FileSystemOperation::DidTouchFile(base::PlatformFileError rv) { |
315 if (rv == base::PLATFORM_FILE_OK) | 316 if (rv == base::PLATFORM_FILE_OK) |
316 dispatcher_->DidSucceed(); | 317 dispatcher_->DidSucceed(); |
317 else | 318 else |
318 dispatcher_->DidFail(rv); | 319 dispatcher_->DidFail(rv); |
319 delete this; | 320 delete this; |
320 } | 321 } |
321 | 322 |
322 } // namespace fileapi | 323 } // namespace fileapi |
OLD | NEW |