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

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

Issue 6969009: Reduced the lifetime of DownloadCreateInfo. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Removed structure accessors from DownloadItem, per request. Created 9 years, 7 months 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
Index: chrome/browser/download/download_util.cc
diff --git a/chrome/browser/download/download_util.cc b/chrome/browser/download/download_util.cc
index f68d676d78f6ece508d001624b2115205f834d1a..0d7b768ed138d044aa09eb8d935978c2efe9efee 100644
--- a/chrome/browser/download/download_util.cc
+++ b/chrome/browser/download/download_util.cc
@@ -249,12 +249,15 @@ void GenerateExtension(const FilePath& file_name,
generated_extension->swap(extension);
}
-void GenerateFileNameFromInfo(DownloadCreateInfo* info,
- FilePath* generated_name) {
- GenerateFileName(GURL(info->url()),
- info->content_disposition,
- info->referrer_charset,
- info->mime_type,
+void GenerateFileNameFromRequest(const GURL& url,
+ const std::string& content_disposition,
+ const std::string& referrer_charset,
+ const std::string& mime_type,
+ FilePath* generated_name) {
+ GenerateFileName(url,
+ content_disposition,
+ referrer_charset,
+ mime_type,
generated_name);
}
@@ -890,18 +893,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;

Powered by Google App Engine
This is Rietveld 408576698