| 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 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 202 // Microsoft IIS Internet Communication Settings. | 202 // Microsoft IIS Internet Communication Settings. |
| 203 {"ins", ALLOW_ON_USER_GESTURE, ALLOW_AUTO_OPEN}, | 203 {"ins", ALLOW_ON_USER_GESTURE, ALLOW_AUTO_OPEN}, |
| 204 | 204 |
| 205 // Microsoft IIS Internet Service Provider Settings. | 205 // Microsoft IIS Internet Service Provider Settings. |
| 206 {"isp", ALLOW_ON_USER_GESTURE, ALLOW_AUTO_OPEN}, | 206 {"isp", ALLOW_ON_USER_GESTURE, ALLOW_AUTO_OPEN}, |
| 207 | 207 |
| 208 // JavaScript file. May open using Windows Script Host with user level | 208 // JavaScript file. May open using Windows Script Host with user level |
| 209 // privileges. | 209 // privileges. |
| 210 {"js", ALLOW_ON_USER_GESTURE, DISALLOW_AUTO_OPEN}, | 210 {"js", ALLOW_ON_USER_GESTURE, DISALLOW_AUTO_OPEN}, |
| 211 | 211 |
| 212 // JScript encoded script file. | 212 // JScript encoded script file. Usually produced by running Microsoft Script |
| 213 // Encoder over a .js file. |
| 214 // See https://msdn.microsoft.com/library/d14c8zsc.aspx |
| 213 {"jse", ALLOW_ON_USER_GESTURE, DISALLOW_AUTO_OPEN}, | 215 {"jse", ALLOW_ON_USER_GESTURE, DISALLOW_AUTO_OPEN}, |
| 214 | 216 |
| 215 // Shortcuts. May open anything. | 217 // Shortcuts. May open anything. |
| 216 {"lnk", ALLOW_ON_USER_GESTURE, DISALLOW_AUTO_OPEN}, | 218 {"lnk", ALLOW_ON_USER_GESTURE, DISALLOW_AUTO_OPEN}, |
| 217 | 219 |
| 218 // .local files affect DLL search path for .exe file with same base name. | 220 // .local files affect DLL search path for .exe file with same base name. |
| 219 {"local", DANGEROUS, ALLOW_AUTO_OPEN}, | 221 {"local", DANGEROUS, ALLOW_AUTO_OPEN}, |
| 220 | 222 |
| 221 // While being a generic name, having a .manifest file with the same | 223 // While being a generic name, having a .manifest file with the same |
| 222 // basename as .exe file (foo.exe + foo.exe.manifest) changes the dll search | 224 // basename as .exe file (foo.exe + foo.exe.manifest) changes the dll search |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 284 {"ps2xml", ALLOW_ON_USER_GESTURE, DISALLOW_AUTO_OPEN}, | 286 {"ps2xml", ALLOW_ON_USER_GESTURE, DISALLOW_AUTO_OPEN}, |
| 285 {"psc1", ALLOW_ON_USER_GESTURE, DISALLOW_AUTO_OPEN}, | 287 {"psc1", ALLOW_ON_USER_GESTURE, DISALLOW_AUTO_OPEN}, |
| 286 {"psc2", ALLOW_ON_USER_GESTURE, DISALLOW_AUTO_OPEN}, | 288 {"psc2", ALLOW_ON_USER_GESTURE, DISALLOW_AUTO_OPEN}, |
| 287 | 289 |
| 288 // Registry file. Opening may cause registry settings to change. Users still | 290 // Registry file. Opening may cause registry settings to change. Users still |
| 289 // need to click through a prompt. So we could consider relaxing the | 291 // need to click through a prompt. So we could consider relaxing the |
| 290 // DISALLOW_AUTO_OPEN restriction. | 292 // DISALLOW_AUTO_OPEN restriction. |
| 291 {"reg", ALLOW_ON_USER_GESTURE, DISALLOW_AUTO_OPEN}, | 293 {"reg", ALLOW_ON_USER_GESTURE, DISALLOW_AUTO_OPEN}, |
| 292 | 294 |
| 293 // Microsoft Windows Explorer Command. | 295 // Microsoft Windows Explorer Command. |
| 296 // See https://support.microsoft.com/kb/190355 for an example. |
| 294 {"scf", ALLOW_ON_USER_GESTURE, ALLOW_AUTO_OPEN}, | 297 {"scf", ALLOW_ON_USER_GESTURE, ALLOW_AUTO_OPEN}, |
| 295 | 298 |
| 296 // Microsoft Windows Screen Saver. | 299 // Microsoft Windows Screen Saver. |
| 297 {"scr", ALLOW_ON_USER_GESTURE, DISALLOW_AUTO_OPEN}, | 300 {"scr", ALLOW_ON_USER_GESTURE, DISALLOW_AUTO_OPEN}, |
| 298 | 301 |
| 299 // Microsoft Windows Script Component. Microsoft FoxPro Screen. | 302 // Microsoft Windows Script Component. Microsoft FoxPro Screen. |
| 303 // A Script Component is a COM component created using script. |
| 304 // See https://msdn.microsoft.com/library/aa233148.aspx for an example. |
| 300 {"sct", ALLOW_ON_USER_GESTURE, ALLOW_AUTO_OPEN}, | 305 {"sct", ALLOW_ON_USER_GESTURE, ALLOW_AUTO_OPEN}, |
| 301 | 306 |
| 302 // Microsoft Windows Shortcut into a document. | 307 // Microsoft Windows Shortcut into a document. |
| 308 // See https://support.microsoft.com/kb/212344 |
| 303 {"shb", ALLOW_ON_USER_GESTURE, ALLOW_AUTO_OPEN}, | 309 {"shb", ALLOW_ON_USER_GESTURE, ALLOW_AUTO_OPEN}, |
| 304 | 310 |
| 305 // Shell Scrap Object File. | 311 // Shell Scrap Object File. |
| 306 {"shs", ALLOW_ON_USER_GESTURE, ALLOW_AUTO_OPEN}, | 312 {"shs", ALLOW_ON_USER_GESTURE, ALLOW_AUTO_OPEN}, |
| 307 | 313 |
| 308 // System executable. Windows tries hard to prevent you from opening these | 314 // System executable. Windows tries hard to prevent you from opening these |
| 309 // types of files. | 315 // types of files. |
| 310 {"sys", DANGEROUS, DISALLOW_AUTO_OPEN}, | 316 {"sys", DANGEROUS, DISALLOW_AUTO_OPEN}, |
| 311 | 317 |
| 312 // Internet Shortcut (new since IE9). Both .url and .website are .ini files | 318 // Internet Shortcut (new since IE9). Both .url and .website are .ini files |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 422 | 428 |
| 423 DownloadDangerLevel GetFileDangerLevel(const base::FilePath& path) { | 429 DownloadDangerLevel GetFileDangerLevel(const base::FilePath& path) { |
| 424 return GetFileType(path).danger_level; | 430 return GetFileType(path).danger_level; |
| 425 } | 431 } |
| 426 | 432 |
| 427 bool IsAllowedToOpenAutomatically(const base::FilePath& path) { | 433 bool IsAllowedToOpenAutomatically(const base::FilePath& path) { |
| 428 return GetFileType(path).auto_open_hint == ALLOW_AUTO_OPEN; | 434 return GetFileType(path).auto_open_hint == ALLOW_AUTO_OPEN; |
| 429 } | 435 } |
| 430 | 436 |
| 431 } // namespace download_util | 437 } // namespace download_util |
| OLD | NEW |