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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 static const struct Executables { | 59 static const struct Executables { |
60 const char* extension; | 60 const char* extension; |
61 DownloadDangerLevel level; | 61 DownloadDangerLevel level; |
62 } g_executables[] = { | 62 } g_executables[] = { |
63 // Chrome OS does not suffer from some of the problems of older OS'es. | 63 // Chrome OS does not suffer from some of the problems of older OS'es. |
64 #if !defined(OS_CHROMEOS) | 64 #if !defined(OS_CHROMEOS) |
65 // Relating to Java. | 65 // Relating to Java. |
66 { "class", DANGEROUS }, | 66 { "class", DANGEROUS }, |
67 { "jar", DANGEROUS }, | 67 { "jar", DANGEROUS }, |
68 { "jnlp", DANGEROUS }, | 68 { "jnlp", DANGEROUS }, |
| 69 #endif |
| 70 #if !defined(OS_CHROMEOS) && !defined(OS_ANDROID) |
69 // Relating to PDF. | 71 // Relating to PDF. |
70 { "pdf", ALLOW_ON_USER_GESTURE }, | 72 { "pdf", ALLOW_ON_USER_GESTURE }, |
71 { "pdfxml", ALLOW_ON_USER_GESTURE }, | 73 { "pdfxml", ALLOW_ON_USER_GESTURE }, |
72 { "mars", ALLOW_ON_USER_GESTURE }, | 74 { "mars", ALLOW_ON_USER_GESTURE }, |
73 { "fdf", ALLOW_ON_USER_GESTURE }, | 75 { "fdf", ALLOW_ON_USER_GESTURE }, |
74 { "xfdf", ALLOW_ON_USER_GESTURE }, | 76 { "xfdf", ALLOW_ON_USER_GESTURE }, |
75 { "xdp", ALLOW_ON_USER_GESTURE }, | 77 { "xdp", ALLOW_ON_USER_GESTURE }, |
76 { "xfd", ALLOW_ON_USER_GESTURE }, | 78 { "xfd", ALLOW_ON_USER_GESTURE }, |
77 // Relating to scripting languages. | 79 // Relating to scripting languages. |
78 { "pl", ALLOW_ON_USER_GESTURE }, | 80 { "pl", ALLOW_ON_USER_GESTURE }, |
79 { "py", ALLOW_ON_USER_GESTURE }, | 81 { "py", ALLOW_ON_USER_GESTURE }, |
| 82 { "pyc", ALLOW_ON_USER_GESTURE }, |
80 { "pyw", ALLOW_ON_USER_GESTURE }, | 83 { "pyw", ALLOW_ON_USER_GESTURE }, |
81 { "rb", ALLOW_ON_USER_GESTURE }, | 84 { "rb", ALLOW_ON_USER_GESTURE }, |
82 #endif | 85 #endif |
83 // Some files are dangerous on all platforms. | 86 // Some files are dangerous on all platforms. |
84 // Flash files downloaded locally can sometimes access the local filesystem. | 87 // Flash files downloaded locally can sometimes access the local filesystem. |
85 { "swf", ALLOW_ON_USER_GESTURE }, | 88 { "swf", ALLOW_ON_USER_GESTURE }, |
86 // Chrome extensions should be obtained through the web store. | 89 // Chrome extensions should be obtained through the web store. |
87 { "crx", ALLOW_ON_USER_GESTURE }, | 90 { "crx", ALLOW_ON_USER_GESTURE }, |
88 // These types can run JavaScript (e.g. HTML and HTML-like). | 91 // These types can run JavaScript (e.g. HTML and HTML-like). |
89 // TODO(cevans): work out whether our restrictions on file:/// are strong | 92 // TODO(cevans): work out whether our restrictions on file:/// are strong |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
271 for (size_t i = 0; i < arraysize(kExecutableBlackList); ++i) { | 274 for (size_t i = 0; i < arraysize(kExecutableBlackList); ++i) { |
272 if (net::MatchesMimeType(kExecutableBlackList[i], mime_type)) | 275 if (net::MatchesMimeType(kExecutableBlackList[i], mime_type)) |
273 return false; | 276 return false; |
274 } | 277 } |
275 // We consider only other application types to be executable. | 278 // We consider only other application types to be executable. |
276 return net::MatchesMimeType("application/*", mime_type); | 279 return net::MatchesMimeType("application/*", mime_type); |
277 } | 280 } |
278 | 281 |
279 | 282 |
280 } // namespace download_util | 283 } // namespace download_util |
OLD | NEW |