OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_util.h" | 8 #include "chrome/browser/download/download_util.h" |
9 | 9 |
10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 * under the terms of either the GPL or the LGPL, and not to allow others to | 50 * under the terms of either the GPL or the LGPL, and not to allow others to |
51 * use your version of this file under the terms of the MPL, indicate your | 51 * use your version of this file under the terms of the MPL, indicate your |
52 * decision by deleting the provisions above and replace them with the notice | 52 * decision by deleting the provisions above and replace them with the notice |
53 * and other provisions required by the GPL or the LGPL. If you do not delete | 53 * and other provisions required by the GPL or the LGPL. If you do not delete |
54 * the provisions above, a recipient may use your version of this file under | 54 * the provisions above, a recipient may use your version of this file under |
55 * the terms of any one of the MPL, the GPL or the LGPL. | 55 * the terms of any one of the MPL, the GPL or the LGPL. |
56 * | 56 * |
57 * ***** END LICENSE BLOCK ***** */ | 57 * ***** END LICENSE BLOCK ***** */ |
58 | 58 |
59 static const char* const g_executables[] = { | 59 static const char* const g_executables[] = { |
| 60 "class", |
| 61 "htm", |
| 62 "html", |
| 63 "jar", |
| 64 "pdf", |
| 65 "pl", |
| 66 "py", |
| 67 "rb", |
| 68 "shtm", |
| 69 "shtml", |
| 70 "svg", |
| 71 "swf", |
| 72 "xht", |
| 73 "xhtm", |
| 74 "xhtml", |
| 75 "xml", |
| 76 "xsl", |
| 77 "xslt", |
60 #if defined(OS_WIN) | 78 #if defined(OS_WIN) |
61 "ad", | 79 "ad", |
62 "ade", | 80 "ade", |
63 "adp", | 81 "adp", |
64 "app", | 82 "app", |
65 "application", | 83 "application", |
66 "asp", | 84 "asp", |
67 "asx", | 85 "asx", |
68 "bas", | 86 "bas", |
69 "bat", | 87 "bat", |
70 "chm", | 88 "chm", |
71 "cmd", | 89 "cmd", |
72 "com", | 90 "com", |
73 "cpl", | 91 "cpl", |
74 "crt", | 92 "crt", |
75 "dll", | 93 "dll", |
76 "exe", | 94 "exe", |
77 "fxp", | 95 "fxp", |
78 "hlp", | 96 "hlp", |
79 "hta", | 97 "hta", |
80 "htm", | |
81 "html", | |
82 "htt", | 98 "htt", |
83 "inf", | 99 "inf", |
84 "ins", | 100 "ins", |
85 "isp", | 101 "isp", |
86 "jar", | |
87 "js", | 102 "js", |
88 "jse", | 103 "jse", |
89 "lnk", | 104 "lnk", |
90 "mad", | 105 "mad", |
91 "maf", | 106 "maf", |
92 "mag", | 107 "mag", |
93 "mam", | 108 "mam", |
94 "maq", | 109 "maq", |
95 "mar", | 110 "mar", |
96 "mas", | 111 "mas", |
(...skipping 22 matching lines...) Expand all Loading... |
119 "plg", | 134 "plg", |
120 "prf", | 135 "prf", |
121 "prg", | 136 "prg", |
122 "pst", | 137 "pst", |
123 "reg", | 138 "reg", |
124 "scf", | 139 "scf", |
125 "scr", | 140 "scr", |
126 "sct", | 141 "sct", |
127 "shb", | 142 "shb", |
128 "shs", | 143 "shs", |
129 "shtm", | |
130 "shtml", | |
131 "svg", | |
132 "url", | 144 "url", |
133 "vb", | 145 "vb", |
134 "vbe", | 146 "vbe", |
135 "vbs", | 147 "vbs", |
136 "vsd", | 148 "vsd", |
137 "vsmacros", | 149 "vsmacros", |
138 "vss", | 150 "vss", |
139 "vst", | 151 "vst", |
140 "vsw", | 152 "vsw", |
141 "ws", | 153 "ws", |
142 "wsc", | 154 "wsc", |
143 "wsf", | 155 "wsf", |
144 "wsh", | 156 "wsh", |
145 "xbap", | 157 "xbap", |
146 "xht", | |
147 "xhtm", | |
148 "xhtml", | |
149 "xml", | |
150 "xsl", | |
151 "xslt", | |
152 #elif defined(OS_MACOSX) | 158 #elif defined(OS_MACOSX) |
153 // TODO(thakis): Figure out what makes sense here -- crbug.com/19096 | 159 // TODO(thakis): Figure out what makes sense here -- crbug.com/19096 |
| 160 "app", |
154 "dmg", | 161 "dmg", |
155 #elif defined(OS_POSIX) | 162 #elif defined(OS_POSIX) |
156 // TODO(estade): lengthen this list. | 163 // TODO(estade): lengthen this list. |
157 "bash", | 164 "bash", |
158 "csh", | 165 "csh", |
159 "deb", | 166 "deb", |
160 "exe", | 167 "exe", |
161 "ksh", | 168 "ksh", |
162 "pl", | |
163 "py", | |
164 "rb", | |
165 "rpm", | 169 "rpm", |
166 "sh", | 170 "sh", |
167 "tcsh", | 171 "tcsh", |
168 #endif | 172 #endif |
169 }; | 173 }; |
170 | 174 |
171 bool IsExecutableFile(const FilePath& path) { | 175 bool IsExecutableFile(const FilePath& path) { |
172 return IsExecutableExtension(path.Extension()); | 176 return IsExecutableExtension(path.Extension()); |
173 } | 177 } |
174 | 178 |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 for (size_t i = 0; i < arraysize(kExecutableBlackList); ++i) { | 226 for (size_t i = 0; i < arraysize(kExecutableBlackList); ++i) { |
223 if (net::MatchesMimeType(kExecutableBlackList[i], mime_type)) | 227 if (net::MatchesMimeType(kExecutableBlackList[i], mime_type)) |
224 return false; | 228 return false; |
225 } | 229 } |
226 // We consider only other application types to be executable. | 230 // We consider only other application types to be executable. |
227 return net::MatchesMimeType("application/*", mime_type); | 231 return net::MatchesMimeType("application/*", mime_type); |
228 } | 232 } |
229 | 233 |
230 | 234 |
231 } // namespace download_util | 235 } // namespace download_util |
OLD | NEW |