OLD | NEW |
---|---|
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 Loading... | |
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); | |
Paweł Hajdan Jr.
2011/05/19 16:18:25
Instead of having a return parameter and void retu
ahendrickson
2011/05/19 20:16:49
I think that's for another CL.
Paweł Hajdan Jr.
2011/05/20 09:04:42
Okay, I don't want to increase the already high bu
| |
66 | 69 |
67 void GenerateFileNameFromSuggestedName(const GURL& url, | 70 void GenerateFileNameFromSuggestedName(const GURL& url, |
68 const std::string& suggested_name, | 71 const std::string& suggested_name, |
69 const std::string& mime_type, | 72 const std::string& mime_type, |
70 FilePath* generated_name); | 73 FilePath* generated_name); |
71 | 74 |
72 void GenerateFileName(const GURL& url, | 75 void GenerateFileName(const GURL& url, |
73 const std::string& content_disposition, | 76 const std::string& content_disposition, |
74 const std::string& referrer_charset, | 77 const std::string& referrer_charset, |
75 const std::string& mime_type, | 78 const std::string& mime_type, |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
264 | 267 |
265 // Erases all downloaded files with the specified path and name prefix. | 268 // Erases all downloaded files with the specified path and name prefix. |
266 // Used by download UI tests to clean up the download directory. | 269 // Used by download UI tests to clean up the download directory. |
267 void EraseUniqueDownloadFiles(const FilePath& path_prefix); | 270 void EraseUniqueDownloadFiles(const FilePath& path_prefix); |
268 | 271 |
269 // Returns a .crdownload intermediate path for the |suggested_path|. | 272 // Returns a .crdownload intermediate path for the |suggested_path|. |
270 FilePath GetCrDownloadPath(const FilePath& suggested_path); | 273 FilePath GetCrDownloadPath(const FilePath& suggested_path); |
271 | 274 |
272 // Returns true if this download should show the "dangerous file" warning. | 275 // Returns true if this download should show the "dangerous file" warning. |
273 // Various factors are considered, such as the type of the file, whether a | 276 // Various factors are considered, such as the type of the file, whether a |
274 // user action initiated the download, and whether the user has explictly | 277 // user action initiated the download, and whether the user has explicitly |
275 // marked the file type as "auto open". | 278 // marked the file type as "auto open". |
276 bool IsDangerous(DownloadCreateInfo* info, Profile* profile, bool auto_open); | 279 bool IsDangerous(const GURL& url, |
Paweł Hajdan Jr.
2011/05/19 16:18:25
This has a lot of parameters now, and two bool par
ahendrickson
2011/05/19 20:16:49
I used to have a DownloadRequestInfo structure tha
Paweł Hajdan Jr.
2011/05/20 09:04:42
Hmm, okay, I trust this judgment.
Randy Smith (Not in Mondays)
2011/05/20 19:49:29
Let me suggest an alternative (Pawel, your opinion
ahendrickson
2011/05/20 22:12:44
Done.
Paweł Hajdan Jr.
2011/05/23 14:04:23
Sounds good to me.
| |
280 const GURL& referrer_url, | |
281 const FilePath& suggested_path, | |
282 bool has_user_gesture, | |
283 bool is_extension_install, | |
284 Profile* profile, | |
285 bool auto_open); | |
277 | 286 |
278 } // namespace download_util | 287 } // namespace download_util |
279 | 288 |
280 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_UTIL_H_ | 289 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_UTIL_H_ |
OLD | NEW |