OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #ifndef CHROME_BROWSER_DOWNLOAD_DOWNLOAD_TARGET_INFO_H_ | 5 #ifndef CHROME_BROWSER_DOWNLOAD_DOWNLOAD_TARGET_INFO_H_ |
6 #define CHROME_BROWSER_DOWNLOAD_DOWNLOAD_TARGET_INFO_H_ | 6 #define CHROME_BROWSER_DOWNLOAD_DOWNLOAD_TARGET_INFO_H_ |
7 | 7 |
8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
9 #include "content/public/browser/download_danger_type.h" | 9 #include "content/public/browser/download_danger_type.h" |
10 #include "content/public/browser/download_item.h" | 10 #include "content/public/browser/download_item.h" |
11 | 11 |
12 struct DownloadTargetInfo { | 12 struct DownloadTargetInfo { |
13 DownloadTargetInfo(); | 13 DownloadTargetInfo(); |
14 ~DownloadTargetInfo(); | 14 ~DownloadTargetInfo(); |
15 | 15 |
16 // Final full target path of the download. Must be non-empty for the remaining | 16 // Final full target path of the download. Must be non-empty for the remaining |
17 // fields to be considered valid. The path is a local file system path. Any | 17 // fields to be considered valid. The path is a local file system path. Any |
18 // existing file at this path should be overwritten. | 18 // existing file at this path should be overwritten. |
19 base::FilePath target_path; | 19 base::FilePath target_path; |
20 | 20 |
21 // Disposition. This will be TARGET_DISPOSITION_PROMPT if the user was | 21 // Disposition. This will be TARGET_DISPOSITION_PROMPT if the user was |
22 // prompted during the process of determining the download target. Otherwise | 22 // prompted during the process of determining the download target. Otherwise |
23 // it will be TARGET_DISPOSITION_OVERWRITE. | 23 // it will be TARGET_DISPOSITION_OVERWRITE. |
24 content::DownloadItem::TargetDisposition target_disposition; | 24 content::DownloadItem::TargetDisposition target_disposition; |
25 | 25 |
26 // Danger type of the download. | 26 // Danger type of the download. |
27 content::DownloadDangerType danger_type; | 27 content::DownloadDangerType danger_type; |
28 | 28 |
| 29 // The danger type of the download could be set to MAYBE_DANGEROUS_CONTENT if |
| 30 // the file type is handled by SafeBrowsing. However, if the SafeBrowsing |
| 31 // service is unable to verify whether the file is safe or not, we are on our |
| 32 // own. This flag indicates whether the download should be considered |
| 33 // dangerous if SafeBrowsing returns an unknown verdict. |
| 34 // |
| 35 // Note that some downloads (e.g. "Save link as" on a link to a binary) would |
| 36 // not be considered 'Dangerous' even if SafeBrowsing came back with an |
| 37 // unknown verdict. So we can't always show a warning when SB fails. |
| 38 bool is_dangerous_file; |
| 39 |
29 // Suggested intermediate path. The downloaded bytes should be written to this | 40 // Suggested intermediate path. The downloaded bytes should be written to this |
30 // path until all the bytes are available and the user has accepted a | 41 // path until all the bytes are available and the user has accepted a |
31 // dangerous download. At that point, the download can be renamed to | 42 // dangerous download. At that point, the download can be renamed to |
32 // |target_path|. | 43 // |target_path|. |
33 base::FilePath intermediate_path; | 44 base::FilePath intermediate_path; |
34 | 45 |
35 // MIME type based on the file type of the download. This may be different | 46 // MIME type based on the file type of the download. This may be different |
36 // from DownloadItem::GetMimeType() since the latter is based on the server | 47 // from DownloadItem::GetMimeType() since the latter is based on the server |
37 // response, and this one is based on the filename. | 48 // response, and this one is based on the filename. |
38 std::string mime_type; | 49 std::string mime_type; |
39 | 50 |
40 // Whether the |target_path| would be handled safely by the browser if it were | 51 // Whether the |target_path| would be handled safely by the browser if it were |
41 // to be opened with a file:// URL. This can be used later to decide how file | 52 // to be opened with a file:// URL. This can be used later to decide how file |
42 // opens should be handled. The file is considered to be handled safely if the | 53 // opens should be handled. The file is considered to be handled safely if the |
43 // filetype is supported by the renderer or a sandboxed plug-in. | 54 // filetype is supported by the renderer or a sandboxed plug-in. |
44 bool is_filetype_handled_safely; | 55 bool is_filetype_handled_safely; |
45 }; | 56 }; |
46 | 57 |
47 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_TARGET_INFO_H_ | 58 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_TARGET_INFO_H_ |
OLD | NEW |