| 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 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 { "prg", ALLOW_ON_USER_GESTURE }, | 172 { "prg", ALLOW_ON_USER_GESTURE }, |
| 173 { "pst", ALLOW_ON_USER_GESTURE }, | 173 { "pst", ALLOW_ON_USER_GESTURE }, |
| 174 { "reg", ALLOW_ON_USER_GESTURE }, | 174 { "reg", ALLOW_ON_USER_GESTURE }, |
| 175 { "scf", ALLOW_ON_USER_GESTURE }, | 175 { "scf", ALLOW_ON_USER_GESTURE }, |
| 176 { "scr", ALLOW_ON_USER_GESTURE }, | 176 { "scr", ALLOW_ON_USER_GESTURE }, |
| 177 { "sct", ALLOW_ON_USER_GESTURE }, | 177 { "sct", ALLOW_ON_USER_GESTURE }, |
| 178 { "shb", ALLOW_ON_USER_GESTURE }, | 178 { "shb", ALLOW_ON_USER_GESTURE }, |
| 179 { "shs", ALLOW_ON_USER_GESTURE }, | 179 { "shs", ALLOW_ON_USER_GESTURE }, |
| 180 { "sys", DANGEROUS }, | 180 { "sys", DANGEROUS }, |
| 181 { "url", ALLOW_ON_USER_GESTURE }, | 181 { "url", ALLOW_ON_USER_GESTURE }, |
| 182 // TODO(davidben): Remove this when double-extensions are no longer | |
| 183 // a nuisance. | |
| 184 { "user.js", ALLOW_ON_USER_GESTURE }, | |
| 185 { "vb", ALLOW_ON_USER_GESTURE }, | 182 { "vb", ALLOW_ON_USER_GESTURE }, |
| 186 { "vbe", ALLOW_ON_USER_GESTURE }, | 183 { "vbe", ALLOW_ON_USER_GESTURE }, |
| 187 { "vbs", ALLOW_ON_USER_GESTURE }, | 184 { "vbs", ALLOW_ON_USER_GESTURE }, |
| 188 { "vsd", ALLOW_ON_USER_GESTURE }, | 185 { "vsd", ALLOW_ON_USER_GESTURE }, |
| 189 { "vsmacros", ALLOW_ON_USER_GESTURE }, | 186 { "vsmacros", ALLOW_ON_USER_GESTURE }, |
| 190 { "vss", ALLOW_ON_USER_GESTURE }, | 187 { "vss", ALLOW_ON_USER_GESTURE }, |
| 191 { "vst", ALLOW_ON_USER_GESTURE }, | 188 { "vst", ALLOW_ON_USER_GESTURE }, |
| 192 { "vsw", ALLOW_ON_USER_GESTURE }, | 189 { "vsw", ALLOW_ON_USER_GESTURE }, |
| 193 { "ws", ALLOW_ON_USER_GESTURE }, | 190 { "ws", ALLOW_ON_USER_GESTURE }, |
| 194 { "wsc", ALLOW_ON_USER_GESTURE }, | 191 { "wsc", ALLOW_ON_USER_GESTURE }, |
| (...skipping 22 matching lines...) Expand all Loading... |
| 217 { "exe", ALLOW_ON_USER_GESTURE }, | 214 { "exe", ALLOW_ON_USER_GESTURE }, |
| 218 { "ksh", ALLOW_ON_USER_GESTURE }, | 215 { "ksh", ALLOW_ON_USER_GESTURE }, |
| 219 { "rpm", ALLOW_ON_USER_GESTURE }, | 216 { "rpm", ALLOW_ON_USER_GESTURE }, |
| 220 { "sh", ALLOW_ON_USER_GESTURE }, | 217 { "sh", ALLOW_ON_USER_GESTURE }, |
| 221 { "shar", ALLOW_ON_USER_GESTURE }, | 218 { "shar", ALLOW_ON_USER_GESTURE }, |
| 222 { "tcsh", ALLOW_ON_USER_GESTURE }, | 219 { "tcsh", ALLOW_ON_USER_GESTURE }, |
| 223 #endif | 220 #endif |
| 224 }; | 221 }; |
| 225 | 222 |
| 226 DownloadDangerLevel GetFileDangerLevel(const base::FilePath& path) { | 223 DownloadDangerLevel GetFileDangerLevel(const base::FilePath& path) { |
| 227 base::FilePath::StringType extension(path.Extension()); | 224 base::FilePath::StringType extension(path.FinalExtension()); |
| 228 if (extension.empty()) | 225 if (extension.empty()) |
| 229 return NOT_DANGEROUS; | 226 return NOT_DANGEROUS; |
| 230 if (!IsStringASCII(extension)) | 227 if (!IsStringASCII(extension)) |
| 231 return NOT_DANGEROUS; | 228 return NOT_DANGEROUS; |
| 232 #if defined(OS_WIN) | 229 #if defined(OS_WIN) |
| 233 std::string ascii_extension = WideToASCII(extension); | 230 std::string ascii_extension = WideToASCII(extension); |
| 234 #elif defined(OS_POSIX) | 231 #elif defined(OS_POSIX) |
| 235 std::string ascii_extension = extension; | 232 std::string ascii_extension = extension; |
| 236 #endif | 233 #endif |
| 237 | 234 |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 274 for (size_t i = 0; i < arraysize(kExecutableBlackList); ++i) { | 271 for (size_t i = 0; i < arraysize(kExecutableBlackList); ++i) { |
| 275 if (net::MatchesMimeType(kExecutableBlackList[i], mime_type)) | 272 if (net::MatchesMimeType(kExecutableBlackList[i], mime_type)) |
| 276 return false; | 273 return false; |
| 277 } | 274 } |
| 278 // We consider only other application types to be executable. | 275 // We consider only other application types to be executable. |
| 279 return net::MatchesMimeType("application/*", mime_type); | 276 return net::MatchesMimeType("application/*", mime_type); |
| 280 } | 277 } |
| 281 | 278 |
| 282 | 279 |
| 283 } // namespace download_util | 280 } // namespace download_util |
| OLD | NEW |