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 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 { "prg", ALLOW_ON_USER_GESTURE }, | 159 { "prg", ALLOW_ON_USER_GESTURE }, |
160 { "pst", ALLOW_ON_USER_GESTURE }, | 160 { "pst", ALLOW_ON_USER_GESTURE }, |
161 { "reg", ALLOW_ON_USER_GESTURE }, | 161 { "reg", ALLOW_ON_USER_GESTURE }, |
162 { "scf", ALLOW_ON_USER_GESTURE }, | 162 { "scf", ALLOW_ON_USER_GESTURE }, |
163 { "scr", ALLOW_ON_USER_GESTURE }, | 163 { "scr", ALLOW_ON_USER_GESTURE }, |
164 { "sct", ALLOW_ON_USER_GESTURE }, | 164 { "sct", ALLOW_ON_USER_GESTURE }, |
165 { "shb", ALLOW_ON_USER_GESTURE }, | 165 { "shb", ALLOW_ON_USER_GESTURE }, |
166 { "shs", ALLOW_ON_USER_GESTURE }, | 166 { "shs", ALLOW_ON_USER_GESTURE }, |
167 { "sys", DANGEROUS }, | 167 { "sys", DANGEROUS }, |
168 { "url", ALLOW_ON_USER_GESTURE }, | 168 { "url", ALLOW_ON_USER_GESTURE }, |
169 // TODO(davidben): Remove this when double-extensions are no longer | |
170 // a nuisance. | |
171 { "user.js", ALLOW_ON_USER_GESTURE }, | |
172 { "vb", ALLOW_ON_USER_GESTURE }, | 169 { "vb", ALLOW_ON_USER_GESTURE }, |
173 { "vbe", ALLOW_ON_USER_GESTURE }, | 170 { "vbe", ALLOW_ON_USER_GESTURE }, |
174 { "vbs", ALLOW_ON_USER_GESTURE }, | 171 { "vbs", ALLOW_ON_USER_GESTURE }, |
175 { "vsd", ALLOW_ON_USER_GESTURE }, | 172 { "vsd", ALLOW_ON_USER_GESTURE }, |
176 { "vsmacros", ALLOW_ON_USER_GESTURE }, | 173 { "vsmacros", ALLOW_ON_USER_GESTURE }, |
177 { "vss", ALLOW_ON_USER_GESTURE }, | 174 { "vss", ALLOW_ON_USER_GESTURE }, |
178 { "vst", ALLOW_ON_USER_GESTURE }, | 175 { "vst", ALLOW_ON_USER_GESTURE }, |
179 { "vsw", ALLOW_ON_USER_GESTURE }, | 176 { "vsw", ALLOW_ON_USER_GESTURE }, |
180 { "ws", ALLOW_ON_USER_GESTURE }, | 177 { "ws", ALLOW_ON_USER_GESTURE }, |
181 { "wsc", ALLOW_ON_USER_GESTURE }, | 178 { "wsc", ALLOW_ON_USER_GESTURE }, |
(...skipping 22 matching lines...) Expand all Loading... |
204 { "exe", ALLOW_ON_USER_GESTURE }, | 201 { "exe", ALLOW_ON_USER_GESTURE }, |
205 { "ksh", ALLOW_ON_USER_GESTURE }, | 202 { "ksh", ALLOW_ON_USER_GESTURE }, |
206 { "rpm", ALLOW_ON_USER_GESTURE }, | 203 { "rpm", ALLOW_ON_USER_GESTURE }, |
207 { "sh", ALLOW_ON_USER_GESTURE }, | 204 { "sh", ALLOW_ON_USER_GESTURE }, |
208 { "shar", ALLOW_ON_USER_GESTURE }, | 205 { "shar", ALLOW_ON_USER_GESTURE }, |
209 { "tcsh", ALLOW_ON_USER_GESTURE }, | 206 { "tcsh", ALLOW_ON_USER_GESTURE }, |
210 #endif | 207 #endif |
211 }; | 208 }; |
212 | 209 |
213 DownloadDangerLevel GetFileDangerLevel(const base::FilePath& path) { | 210 DownloadDangerLevel GetFileDangerLevel(const base::FilePath& path) { |
214 base::FilePath::StringType extension(path.Extension()); | 211 base::FilePath::StringType extension(path.FinalExtension()); |
215 if (extension.empty()) | 212 if (extension.empty()) |
216 return NOT_DANGEROUS; | 213 return NOT_DANGEROUS; |
217 if (!IsStringASCII(extension)) | 214 if (!IsStringASCII(extension)) |
218 return NOT_DANGEROUS; | 215 return NOT_DANGEROUS; |
219 #if defined(OS_WIN) | 216 #if defined(OS_WIN) |
220 std::string ascii_extension = WideToASCII(extension); | 217 std::string ascii_extension = WideToASCII(extension); |
221 #elif defined(OS_POSIX) | 218 #elif defined(OS_POSIX) |
222 std::string ascii_extension = extension; | 219 std::string ascii_extension = extension; |
223 #endif | 220 #endif |
224 | 221 |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
261 for (size_t i = 0; i < arraysize(kExecutableBlackList); ++i) { | 258 for (size_t i = 0; i < arraysize(kExecutableBlackList); ++i) { |
262 if (net::MatchesMimeType(kExecutableBlackList[i], mime_type)) | 259 if (net::MatchesMimeType(kExecutableBlackList[i], mime_type)) |
263 return false; | 260 return false; |
264 } | 261 } |
265 // We consider only other application types to be executable. | 262 // We consider only other application types to be executable. |
266 return net::MatchesMimeType("application/*", mime_type); | 263 return net::MatchesMimeType("application/*", mime_type); |
267 } | 264 } |
268 | 265 |
269 | 266 |
270 } // namespace download_util | 267 } // namespace download_util |
OLD | NEW |