| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "net/base/filename_util.h" | 5 #include "net/base/filename_util.h" |
| 6 | 6 |
| 7 #include "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
| 8 #include "base/files/file_util.h" | 8 #include "base/files/file_util.h" |
| 9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
| 10 #include "base/strings/sys_string_conversions.h" | 10 #include "base/strings/sys_string_conversions.h" |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 // If the URL contains a (possibly empty) query, assume it is a generator, and | 83 // If the URL contains a (possibly empty) query, assume it is a generator, and |
| 84 // allow the determined extension to be overwritten. | 84 // allow the determined extension to be overwritten. |
| 85 *should_overwrite_extension = !decoded_filename.empty() && url.has_query(); | 85 *should_overwrite_extension = !decoded_filename.empty() && url.has_query(); |
| 86 | 86 |
| 87 return decoded_filename; | 87 return decoded_filename; |
| 88 } | 88 } |
| 89 | 89 |
| 90 // Returns whether the specified extension is automatically integrated into the | 90 // Returns whether the specified extension is automatically integrated into the |
| 91 // windows shell. | 91 // windows shell. |
| 92 bool IsShellIntegratedExtension(const base::FilePath::StringType& extension) { | 92 bool IsShellIntegratedExtension(const base::FilePath::StringType& extension) { |
| 93 base::FilePath::StringType extension_lower = | 93 base::FilePath::StringType extension_lower = base::ToLowerASCII(extension); |
| 94 base::StringToLowerASCII(extension); | |
| 95 | 94 |
| 96 // http://msdn.microsoft.com/en-us/library/ms811694.aspx | 95 // http://msdn.microsoft.com/en-us/library/ms811694.aspx |
| 97 // Right-clicking on shortcuts can be magical. | 96 // Right-clicking on shortcuts can be magical. |
| 98 if ((extension_lower == FILE_PATH_LITERAL("local")) || | 97 if ((extension_lower == FILE_PATH_LITERAL("local")) || |
| 99 (extension_lower == FILE_PATH_LITERAL("lnk"))) | 98 (extension_lower == FILE_PATH_LITERAL("lnk"))) |
| 100 return true; | 99 return true; |
| 101 | 100 |
| 102 // http://www.juniper.net/security/auto/vulnerabilities/vuln2612.html | 101 // http://www.juniper.net/security/auto/vulnerabilities/vuln2612.html |
| 103 // Files become magical if they end in a CLSID, so block such extensions. | 102 // Files become magical if they end in a CLSID, so block such extensions. |
| 104 if (!extension_lower.empty() && | 103 if (!extension_lower.empty() && |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 278 base::FilePath generated_name( | 277 base::FilePath generated_name( |
| 279 base::SysWideToNativeMB(base::UTF16ToWide(file_name))); | 278 base::SysWideToNativeMB(base::UTF16ToWide(file_name))); |
| 280 #endif | 279 #endif |
| 281 | 280 |
| 282 DCHECK(!generated_name.empty()); | 281 DCHECK(!generated_name.empty()); |
| 283 | 282 |
| 284 return generated_name; | 283 return generated_name; |
| 285 } | 284 } |
| 286 | 285 |
| 287 } // namespace net | 286 } // namespace net |
| OLD | NEW |