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

Side by Side Diff: chrome/browser/download/download_util.h

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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 // Download utilities. 5 // Download utilities.
6 6
7 #ifndef CHROME_BROWSER_DOWNLOAD_DOWNLOAD_UTIL_H_ 7 #ifndef CHROME_BROWSER_DOWNLOAD_DOWNLOAD_UTIL_H_
8 #define CHROME_BROWSER_DOWNLOAD_DOWNLOAD_UTIL_H_ 8 #define CHROME_BROWSER_DOWNLOAD_DOWNLOAD_UTIL_H_
9 #pragma once 9 #pragma once
10 10
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 54
55 // Return true if the |download_path| is dangerous path. 55 // Return true if the |download_path| is dangerous path.
56 bool DownloadPathIsDangerous(const FilePath& download_path); 56 bool DownloadPathIsDangerous(const FilePath& download_path);
57 57
58 // Create an extension based on the file name and mime type. 58 // Create an extension based on the file name and mime type.
59 void GenerateExtension(const FilePath& file_name, 59 void GenerateExtension(const FilePath& file_name,
60 const std::string& mime_type, 60 const std::string& mime_type,
61 FilePath::StringType* generated_extension); 61 FilePath::StringType* generated_extension);
62 62
63 // Create a file name based on the response from the server. 63 // Create a file name based on the response from the server.
64 void GenerateFileNameFromInfo(DownloadCreateInfo* info, 64 void GenerateFileNameFromRequest(const GURL& url,
65 FilePath* generated_name); 65 const std::string& content_disposition,
66 const std::string& referrer_charset,
67 const std::string& mime_type,
68 FilePath* generated_name);
66 69
67 // Create a file name based on the response from the server. 70 // Create a file name based on the response from the server.
68 void GenerateFileName(const GURL& url, 71 void GenerateFileName(const GURL& url,
69 const std::string& content_disposition, 72 const std::string& content_disposition,
70 const std::string& referrer_charset, 73 const std::string& referrer_charset,
71 const std::string& mime_type, 74 const std::string& mime_type,
72 FilePath* generated_name); 75 FilePath* generated_name);
73 76
74 // Used to make sure we have a safe file extension and filename for a 77 // Used to make sure we have a safe file extension and filename for a
75 // download. |file_name| can either be just the file name or it can be a 78 // download. |file_name| can either be just the file name or it can be a
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 263
261 // Erases all downloaded files with the specified path and name prefix. 264 // Erases all downloaded files with the specified path and name prefix.
262 // Used by download UI tests to clean up the download directory. 265 // Used by download UI tests to clean up the download directory.
263 void EraseUniqueDownloadFiles(const FilePath& path_prefix); 266 void EraseUniqueDownloadFiles(const FilePath& path_prefix);
264 267
265 // Returns a .crdownload intermediate path for the |suggested_path|. 268 // Returns a .crdownload intermediate path for the |suggested_path|.
266 FilePath GetCrDownloadPath(const FilePath& suggested_path); 269 FilePath GetCrDownloadPath(const FilePath& suggested_path);
267 270
268 // Returns true if this download should show the "dangerous file" warning. 271 // Returns true if this download should show the "dangerous file" warning.
269 // Various factors are considered, such as the type of the file, whether a 272 // Various factors are considered, such as the type of the file, whether a
270 // user action initiated the download, and whether the user has explictly 273 // user action initiated the download, and whether the user has explicitly
271 // marked the file type as "auto open". 274 // marked the file type as "auto open".
272 bool IsDangerous(DownloadCreateInfo* info, Profile* profile, bool auto_open); 275 bool IsDangerous(const GURL& url,
276 const GURL& referrer_url,
277 const FilePath& suggested_path,
278 bool has_user_gesture,
279 bool is_extension_install,
280 Profile* profile,
281 bool auto_open);
273 282
274 } // namespace download_util 283 } // namespace download_util
275 284
276 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_UTIL_H_ 285 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_UTIL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698