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 // 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 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 } | 193 } |
194 | 194 |
195 #if defined(OS_WIN) | 195 #if defined(OS_WIN) |
196 // Follow a Windows shortcut. | 196 // Follow a Windows shortcut. |
197 // We just resolve .lnk file, ignore others. | 197 // We just resolve .lnk file, ignore others. |
198 if (!LowerCaseEqualsASCII(file_path_.Extension(), ".lnk")) | 198 if (!LowerCaseEqualsASCII(file_path_.Extension(), ".lnk")) |
199 return false; | 199 return false; |
200 | 200 |
201 FilePath new_path = file_path_; | 201 FilePath new_path = file_path_; |
202 bool resolved; | 202 bool resolved; |
203 resolved = file_util::ResolveShortcut(&new_path); | 203 resolved = file_util::ResolveShortcut(new_path, &new_path, NULL); |
204 | 204 |
205 // If shortcut is not resolved succesfully, do not redirect. | 205 // If shortcut is not resolved succesfully, do not redirect. |
206 if (!resolved) | 206 if (!resolved) |
207 return false; | 207 return false; |
208 | 208 |
209 *location = FilePathToFileURL(new_path); | 209 *location = FilePathToFileURL(new_path); |
210 *http_status_code = 301; | 210 *http_status_code = 301; |
211 return true; | 211 return true; |
212 #else | 212 #else |
213 return false; | 213 return false; |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
341 NotifyDone(URLRequestStatus(URLRequestStatus::FAILED, result)); | 341 NotifyDone(URLRequestStatus(URLRequestStatus::FAILED, result)); |
342 } | 342 } |
343 | 343 |
344 remaining_bytes_ -= result; | 344 remaining_bytes_ -= result; |
345 DCHECK_GE(remaining_bytes_, 0); | 345 DCHECK_GE(remaining_bytes_, 0); |
346 | 346 |
347 NotifyReadComplete(result); | 347 NotifyReadComplete(result); |
348 } | 348 } |
349 | 349 |
350 } // namespace net | 350 } // namespace net |
OLD | NEW |