| 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/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
| (...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 214 std::string ascii_extension = base::UTF16ToASCII(extension); | 214 std::string ascii_extension = base::UTF16ToASCII(extension); |
| 215 #elif defined(OS_POSIX) | 215 #elif defined(OS_POSIX) |
| 216 std::string ascii_extension = extension; | 216 std::string ascii_extension = extension; |
| 217 #endif | 217 #endif |
| 218 | 218 |
| 219 // Strip out leading dot if it's still there | 219 // Strip out leading dot if it's still there |
| 220 if (ascii_extension[0] == base::FilePath::kExtensionSeparator) | 220 if (ascii_extension[0] == base::FilePath::kExtensionSeparator) |
| 221 ascii_extension.erase(0, 1); | 221 ascii_extension.erase(0, 1); |
| 222 | 222 |
| 223 for (size_t i = 0; i < arraysize(g_executables); ++i) { | 223 for (size_t i = 0; i < arraysize(g_executables); ++i) { |
| 224 if (LowerCaseEqualsASCII(ascii_extension, g_executables[i].extension)) | 224 if (base::LowerCaseEqualsASCII(ascii_extension, g_executables[i].extension)) |
| 225 return g_executables[i].level; | 225 return g_executables[i].level; |
| 226 } | 226 } |
| 227 return NOT_DANGEROUS; | 227 return NOT_DANGEROUS; |
| 228 } | 228 } |
| 229 | 229 |
| 230 static const char* kExecutableWhiteList[] = { | 230 static const char* kExecutableWhiteList[] = { |
| 231 // JavaScript is just as powerful as EXE. | 231 // JavaScript is just as powerful as EXE. |
| 232 "text/javascript", | 232 "text/javascript", |
| 233 "text/javascript;version=*", | 233 "text/javascript;version=*", |
| 234 "text/html", | 234 "text/html", |
| (...skipping 20 matching lines...) Expand all Loading... |
| 255 for (size_t i = 0; i < arraysize(kExecutableBlackList); ++i) { | 255 for (size_t i = 0; i < arraysize(kExecutableBlackList); ++i) { |
| 256 if (net::MatchesMimeType(kExecutableBlackList[i], mime_type)) | 256 if (net::MatchesMimeType(kExecutableBlackList[i], mime_type)) |
| 257 return false; | 257 return false; |
| 258 } | 258 } |
| 259 // We consider only other application types to be executable. | 259 // We consider only other application types to be executable. |
| 260 return net::MatchesMimeType("application/*", mime_type); | 260 return net::MatchesMimeType("application/*", mime_type); |
| 261 } | 261 } |
| 262 | 262 |
| 263 | 263 |
| 264 } // namespace download_util | 264 } // namespace download_util |
| OLD | NEW |