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/fileapi/file_system_url_request_job.h" | 5 #include "webkit/fileapi/file_system_url_request_job.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 if (response_info_.get()) | 150 if (response_info_.get()) |
151 return 200; | 151 return 200; |
152 return URLRequestJob::GetResponseCode(); | 152 return URLRequestJob::GetResponseCode(); |
153 } | 153 } |
154 | 154 |
155 void FileSystemURLRequestJob::StartAsync() { | 155 void FileSystemURLRequestJob::StartAsync() { |
156 if (!request_) | 156 if (!request_) |
157 return; | 157 return; |
158 DCHECK(!reader_.get()); | 158 DCHECK(!reader_.get()); |
159 url_ = FileSystemURL(request_->url()); | 159 url_ = FileSystemURL(request_->url()); |
| 160 base::PlatformFileError error_code; |
160 FileSystemOperation* operation = | 161 FileSystemOperation* operation = |
161 file_system_context_->CreateFileSystemOperation(url_); | 162 file_system_context_->CreateFileSystemOperation(url_, &error_code); |
162 if (!operation) { | 163 if (error_code != base::PLATFORM_FILE_OK) { |
163 NotifyDone(URLRequestStatus(URLRequestStatus::FAILED, | 164 NotifyDone(URLRequestStatus(URLRequestStatus::FAILED, |
164 net::ERR_INVALID_URL)); | 165 net::PlatformFileErrorToNetError(error_code))); |
165 return; | 166 return; |
166 } | 167 } |
167 operation->GetMetadata( | 168 operation->GetMetadata( |
168 url_, | 169 url_, |
169 base::Bind(&FileSystemURLRequestJob::DidGetMetadata, | 170 base::Bind(&FileSystemURLRequestJob::DidGetMetadata, |
170 weak_factory_.GetWeakPtr())); | 171 weak_factory_.GetWeakPtr())); |
171 } | 172 } |
172 | 173 |
173 void FileSystemURLRequestJob::DidGetMetadata( | 174 void FileSystemURLRequestJob::DidGetMetadata( |
174 base::PlatformFileError error_code, | 175 base::PlatformFileError error_code, |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
241 } | 242 } |
242 | 243 |
243 return false; | 244 return false; |
244 } | 245 } |
245 | 246 |
246 void FileSystemURLRequestJob::NotifyFailed(int rv) { | 247 void FileSystemURLRequestJob::NotifyFailed(int rv) { |
247 NotifyDone(URLRequestStatus(URLRequestStatus::FAILED, rv)); | 248 NotifyDone(URLRequestStatus(URLRequestStatus::FAILED, rv)); |
248 } | 249 } |
249 | 250 |
250 } // namespace fileapi | 251 } // namespace fileapi |
OLD | NEW |