| OLD | NEW |
| 1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2009 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 // For loading files, we make use of overlapped i/o to ensure that reading from | 5 // For loading files, we make use of overlapped i/o to ensure that reading from |
| 6 // the filesystem (e.g., a network filesystem) does not block the calling | 6 // the filesystem (e.g., a network filesystem) does not block the calling |
| 7 // thread. An alternative approach would be to use a background thread or pool | 7 // thread. An alternative approach would be to use a background thread or pool |
| 8 // of threads, but it seems better to leverage the operating system's ability | 8 // of threads, but it seems better to leverage the operating system's ability |
| 9 // to do background file reads for us. | 9 // to do background file reads for us. |
| 10 // | 10 // |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 | 160 |
| 161 // Otherwise, a read error occured. We may just need to wait... | 161 // Otherwise, a read error occured. We may just need to wait... |
| 162 if (rv == net::ERR_IO_PENDING) { | 162 if (rv == net::ERR_IO_PENDING) { |
| 163 SetStatus(URLRequestStatus(URLRequestStatus::IO_PENDING, 0)); | 163 SetStatus(URLRequestStatus(URLRequestStatus::IO_PENDING, 0)); |
| 164 } else { | 164 } else { |
| 165 NotifyDone(URLRequestStatus(URLRequestStatus::FAILED, rv)); | 165 NotifyDone(URLRequestStatus(URLRequestStatus::FAILED, rv)); |
| 166 } | 166 } |
| 167 return false; | 167 return false; |
| 168 } | 168 } |
| 169 | 169 |
| 170 bool URLRequestFileJob::GetContentEncodings( |
| 171 std::vector<Filter::FilterType>* encoding_types) { |
| 172 DCHECK(encoding_types->empty()); |
| 173 |
| 174 // Bug 9936 - .svgz files needs to be decompressed. |
| 175 if (LowerCaseEqualsASCII(file_path_.Extension(), ".svgz")) |
| 176 encoding_types->push_back(Filter::FILTER_TYPE_GZIP); |
| 177 |
| 178 return !encoding_types->empty(); |
| 179 } |
| 180 |
| 170 bool URLRequestFileJob::GetMimeType(std::string* mime_type) const { | 181 bool URLRequestFileJob::GetMimeType(std::string* mime_type) const { |
| 171 DCHECK(request_); | 182 DCHECK(request_); |
| 172 return net::GetMimeTypeFromFile(file_path_, mime_type); | 183 return net::GetMimeTypeFromFile(file_path_, mime_type); |
| 173 } | 184 } |
| 174 | 185 |
| 175 void URLRequestFileJob::GetResponseInfo(net::HttpResponseInfo* info) { | 186 void URLRequestFileJob::GetResponseInfo(net::HttpResponseInfo* info) { |
| 176 DCHECK(request_); | 187 DCHECK(request_); |
| 177 | 188 |
| 178 // If we have enabled downloading the file, the requester expects to receive | 189 // If we have enabled downloading the file, the requester expects to receive |
| 179 // a file handle to the file. Since we are serving file:/// url requests we | 190 // a file handle to the file. Since we are serving file:/// url requests we |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 294 if (!resolved) | 305 if (!resolved) |
| 295 return false; | 306 return false; |
| 296 | 307 |
| 297 *location = net::FilePathToFileURL(FilePath(new_path)); | 308 *location = net::FilePathToFileURL(FilePath(new_path)); |
| 298 *http_status_code = 301; | 309 *http_status_code = 301; |
| 299 return true; | 310 return true; |
| 300 #else | 311 #else |
| 301 return false; | 312 return false; |
| 302 #endif | 313 #endif |
| 303 } | 314 } |
| OLD | NEW |