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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 GenerateFileNameFromInfo(DownloadCreateInfo* info, |
65 FilePath* generated_name); | 65 FilePath* generated_name); |
66 | 66 |
67 // Create a file name based on the response from the server. | 67 void GenerateFileNameFromSuggestedName(const GURL& url, |
| 68 const std::string& suggested_name, |
| 69 const std::string& mime_type, |
| 70 FilePath* generated_name); |
| 71 |
68 void GenerateFileName(const GURL& url, | 72 void GenerateFileName(const GURL& url, |
69 const std::string& content_disposition, | 73 const std::string& content_disposition, |
70 const std::string& referrer_charset, | 74 const std::string& referrer_charset, |
71 const std::string& mime_type, | 75 const std::string& mime_type, |
72 FilePath* generated_name); | 76 FilePath* generated_name); |
73 | 77 |
74 // Used to make sure we have a safe file extension and filename for a | 78 // 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 | 79 // download. |file_name| can either be just the file name or it can be a |
76 // full path to a file. | 80 // full path to a file. |
77 void GenerateSafeFileName(const std::string& mime_type, FilePath* file_name); | 81 void GenerateSafeFileName(const std::string& mime_type, FilePath* file_name); |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
267 | 271 |
268 // Returns true if this download should show the "dangerous file" warning. | 272 // 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 | 273 // 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 | 274 // user action initiated the download, and whether the user has explictly |
271 // marked the file type as "auto open". | 275 // marked the file type as "auto open". |
272 bool IsDangerous(DownloadCreateInfo* info, Profile* profile, bool auto_open); | 276 bool IsDangerous(DownloadCreateInfo* info, Profile* profile, bool auto_open); |
273 | 277 |
274 } // namespace download_util | 278 } // namespace download_util |
275 | 279 |
276 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_UTIL_H_ | 280 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_UTIL_H_ |
OLD | NEW |