Index: chrome/browser/download/download_util.cc |
diff --git a/chrome/browser/download/download_util.cc b/chrome/browser/download/download_util.cc |
index 326d83179afb57ddd193f8de747a28270e6d3c68..811b3954c5cba43b0c54e1c0affce61910f620a2 100644 |
--- a/chrome/browser/download/download_util.cc |
+++ b/chrome/browser/download/download_util.cc |
@@ -26,6 +26,7 @@ |
#include "base/value_conversions.h" |
#include "base/values.h" |
#include "base/win/windows_version.h" |
+#include "chrome/browser/download/download_create_info.h" |
#include "chrome/browser/download/download_extensions.h" |
#include "chrome/browser/download/download_item.h" |
#include "chrome/browser/download/download_item_model.h" |
@@ -34,7 +35,6 @@ |
#include "chrome/browser/extensions/crx_installer.h" |
#include "chrome/browser/extensions/extension_install_ui.h" |
#include "chrome/browser/extensions/extension_service.h" |
-#include "chrome/browser/history/download_create_info.h" |
#include "chrome/browser/profiles/profile.h" |
#include "chrome/browser/ui/browser.h" |
#include "chrome/common/chrome_paths.h" |
@@ -281,11 +281,17 @@ void GenerateExtension(const FilePath& file_name, |
generated_extension->swap(extension); |
} |
-void GenerateFileNameFromInfo(DownloadCreateInfo* info, |
- FilePath* generated_name) { |
- GenerateFileNameInternal(GURL(info->url()), info->content_disposition, |
- info->referrer_charset, std::string(), |
- info->mime_type, generated_name); |
+void GenerateFileNameFromRequest(const GURL& url, |
+ const std::string& content_disposition, |
+ const std::string& referrer_charset, |
+ const std::string& mime_type, |
+ FilePath* generated_name) { |
+ GenerateFileNameInternal(url, |
+ content_disposition, |
+ referrer_charset, |
+ std::string(), |
+ mime_type, |
+ generated_name); |
} |
void GenerateFileNameFromSuggestedName(const GURL& url, |
@@ -908,18 +914,23 @@ FilePath GetCrDownloadPath(const FilePath& suggested_path) { |
} |
// TODO(erikkay,phajdan.jr): This is apparently not being exercised in tests. |
-bool IsDangerous(DownloadCreateInfo* info, Profile* profile, bool auto_open) { |
+bool IsDangerous(const GURL& url, |
+ const GURL& referrer_url, |
+ const FilePath& suggested_path, |
+ bool has_user_gesture, |
+ bool is_extension_install, |
+ Profile* profile, |
+ bool auto_open) { |
DownloadDangerLevel danger_level = GetFileDangerLevel( |
- info->suggested_path.BaseName()); |
+ suggested_path.BaseName()); |
if (danger_level == Dangerous) |
- return !(auto_open && info->has_user_gesture); |
- if (danger_level == AllowOnUserGesture && !info->has_user_gesture) |
+ return !(auto_open && has_user_gesture); |
+ if (danger_level == AllowOnUserGesture && !has_user_gesture) |
return true; |
- if (info->is_extension_install) { |
+ if (is_extension_install) { |
// Extensions that are not from the gallery are considered dangerous. |
ExtensionService* service = profile->GetExtensionService(); |
- if (!service || |
- !service->IsDownloadFromGallery(info->url(), info->referrer_url)) |
+ if (!service || !service->IsDownloadFromGallery(url, referrer_url)) |
return true; |
} |
return false; |