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 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
273 GURL* location, int* http_status_code) { | 273 GURL* location, int* http_status_code) { |
274 #if defined(OS_WIN) | 274 #if defined(OS_WIN) |
275 std::wstring extension = | 275 std::wstring extension = |
276 file_util::GetFileExtensionFromPath(file_path_.value()); | 276 file_util::GetFileExtensionFromPath(file_path_.value()); |
277 | 277 |
278 // Follow a Windows shortcut. | 278 // Follow a Windows shortcut. |
279 // We just resolve .lnk file, ignore others. | 279 // We just resolve .lnk file, ignore others. |
280 if (!LowerCaseEqualsASCII(extension, "lnk")) | 280 if (!LowerCaseEqualsASCII(extension, "lnk")) |
281 return false; | 281 return false; |
282 | 282 |
283 std::wstring new_path = file_path_.value(); | 283 FilePath new_path = file_path_; |
284 bool resolved; | 284 bool resolved; |
285 resolved = file_util::ResolveShortcut(&new_path); | 285 resolved = file_util::ResolveShortcut(&new_path); |
286 | 286 |
287 // If shortcut is not resolved succesfully, do not redirect. | 287 // If shortcut is not resolved succesfully, do not redirect. |
288 if (!resolved) | 288 if (!resolved) |
289 return false; | 289 return false; |
290 | 290 |
291 *location = net::FilePathToFileURL(FilePath(new_path)); | 291 *location = net::FilePathToFileURL(new_path); |
292 *http_status_code = 301; | 292 *http_status_code = 301; |
293 return true; | 293 return true; |
294 #else | 294 #else |
295 return false; | 295 return false; |
296 #endif | 296 #endif |
297 } | 297 } |
OLD | NEW |