Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(916)

Unified Diff: chrome/browser/download/download_util.cc

Issue 1403001: Modifying the "dangerous download" algorithm. (Closed)
Patch Set: Adding .sys and .drv as Dangerous extensions Created 10 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/download/download_util.h ('k') | chrome/browser/extensions/user_script_listener_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/download/download_util.cc
diff --git a/chrome/browser/download/download_util.cc b/chrome/browser/download/download_util.cc
index cdde9e23fc76b36580d9e3d9ac38555fd7eed043..9374c00c85ab428419c03225f895abc1a510bf37 100644
--- a/chrome/browser/download/download_util.cc
+++ b/chrome/browser/download/download_util.cc
@@ -29,6 +29,7 @@
#include "chrome/browser/browser_list.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/browser_thread.h"
+#include "chrome/browser/download/download_extensions.h"
#include "chrome/browser/download/download_item.h"
#include "chrome/browser/download/download_item_model.h"
#include "chrome/browser/download/download_manager.h"
@@ -721,18 +722,22 @@ FilePath GetCrDownloadPath(const FilePath& suggested_path) {
// TODO(erikkay,phajdan.jr): This is apparently not being exercised in tests.
bool IsDangerous(DownloadCreateInfo* info, Profile* profile) {
- // Downloads can be marked as dangerous for two reasons:
- // a) They have a dangerous-looking filename
- // b) They are an extension that is not from the gallery
- if (IsExecutableFile(info->suggested_path.BaseName())) {
+ DownloadDangerLevel danger_level = GetFileDangerLevel(
+ info->suggested_path.BaseName());
+
+ if (danger_level == Dangerous) {
+ return true;
+ } else if (danger_level == AllowOnUserGesture && !info->has_user_gesture) {
return true;
} else if (info->is_extension_install) {
ExtensionsService* service = profile->GetExtensionsService();
if (!service ||
!service->IsDownloadFromGallery(info->url, info->referrer_url)) {
+ // Extensions that are not from the gallery are considered dangerous.
return true;
}
}
+
return false;
}
« no previous file with comments | « chrome/browser/download/download_util.h ('k') | chrome/browser/extensions/user_script_listener_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698