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 <set> | 5 #include <set> |
6 #include <string> | 6 #include <string> |
7 | 7 |
8 #include "chrome/browser/download/download_extensions.h" | 8 #include "chrome/browser/download/download_extensions.h" |
9 | 9 |
10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 #endif | 212 #endif |
213 }; | 213 }; |
214 | 214 |
215 DownloadDangerLevel GetFileDangerLevel(const base::FilePath& path) { | 215 DownloadDangerLevel GetFileDangerLevel(const base::FilePath& path) { |
216 base::FilePath::StringType extension(path.Extension()); | 216 base::FilePath::StringType extension(path.Extension()); |
217 if (extension.empty()) | 217 if (extension.empty()) |
218 return NotDangerous; | 218 return NotDangerous; |
219 if (!IsStringASCII(extension)) | 219 if (!IsStringASCII(extension)) |
220 return NotDangerous; | 220 return NotDangerous; |
221 #if defined(OS_WIN) | 221 #if defined(OS_WIN) |
222 std::string ascii_extension = WideToASCII(extension); | 222 std::string ascii_extension = base::WideToASCII(extension); |
223 #elif defined(OS_POSIX) | 223 #elif defined(OS_POSIX) |
224 std::string ascii_extension = extension; | 224 std::string ascii_extension = extension; |
225 #endif | 225 #endif |
226 | 226 |
227 // Strip out leading dot if it's still there | 227 // Strip out leading dot if it's still there |
228 if (ascii_extension[0] == base::FilePath::kExtensionSeparator) | 228 if (ascii_extension[0] == base::FilePath::kExtensionSeparator) |
229 ascii_extension.erase(0, 1); | 229 ascii_extension.erase(0, 1); |
230 | 230 |
231 for (size_t i = 0; i < arraysize(g_executables); ++i) { | 231 for (size_t i = 0; i < arraysize(g_executables); ++i) { |
232 if (LowerCaseEqualsASCII(ascii_extension, g_executables[i].extension)) | 232 if (LowerCaseEqualsASCII(ascii_extension, g_executables[i].extension)) |
(...skipping 30 matching lines...) Expand all Loading... |
263 for (size_t i = 0; i < arraysize(kExecutableBlackList); ++i) { | 263 for (size_t i = 0; i < arraysize(kExecutableBlackList); ++i) { |
264 if (net::MatchesMimeType(kExecutableBlackList[i], mime_type)) | 264 if (net::MatchesMimeType(kExecutableBlackList[i], mime_type)) |
265 return false; | 265 return false; |
266 } | 266 } |
267 // We consider only other application types to be executable. | 267 // We consider only other application types to be executable. |
268 return net::MatchesMimeType("application/*", mime_type); | 268 return net::MatchesMimeType("application/*", mime_type); |
269 } | 269 } |
270 | 270 |
271 | 271 |
272 } // namespace download_util | 272 } // namespace download_util |
OLD | NEW |