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/fileapi/file_system_url_request_job.h" | 5 #include "webkit/browser/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_) | 150 if (response_info_) |
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_ = file_system_context_->CrackURL(request_->url()); | 159 url_ = file_system_context_->CrackURL(request_->url()); |
| 160 if (!file_system_context_->CanServeURLRequest(url_)) { |
| 161 // In incognito mode the API is not usable and there should be no data. |
| 162 NotifyFailed(net::ERR_FILE_NOT_FOUND); |
| 163 return; |
| 164 } |
160 file_system_context_->operation_runner()->GetMetadata( | 165 file_system_context_->operation_runner()->GetMetadata( |
161 url_, | 166 url_, |
162 base::Bind(&FileSystemURLRequestJob::DidGetMetadata, | 167 base::Bind(&FileSystemURLRequestJob::DidGetMetadata, |
163 weak_factory_.GetWeakPtr())); | 168 weak_factory_.GetWeakPtr())); |
164 } | 169 } |
165 | 170 |
166 void FileSystemURLRequestJob::DidGetMetadata( | 171 void FileSystemURLRequestJob::DidGetMetadata( |
167 base::PlatformFileError error_code, | 172 base::PlatformFileError error_code, |
168 const base::PlatformFileInfo& file_info) { | 173 const base::PlatformFileInfo& file_info) { |
169 if (error_code != base::PLATFORM_FILE_OK) { | 174 if (error_code != base::PLATFORM_FILE_OK) { |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
231 } | 236 } |
232 | 237 |
233 return false; | 238 return false; |
234 } | 239 } |
235 | 240 |
236 void FileSystemURLRequestJob::NotifyFailed(int rv) { | 241 void FileSystemURLRequestJob::NotifyFailed(int rv) { |
237 NotifyDone(URLRequestStatus(URLRequestStatus::FAILED, rv)); | 242 NotifyDone(URLRequestStatus(URLRequestStatus::FAILED, rv)); |
238 } | 243 } |
239 | 244 |
240 } // namespace fileapi | 245 } // namespace fileapi |
OLD | NEW |