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 <string> |
| 9 |
8 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
| 11 #include "chrome/browser/download/download_target_result.h" |
9 #include "chrome/common/safe_browsing/download_file_types.pb.h" | 12 #include "chrome/common/safe_browsing/download_file_types.pb.h" |
10 #include "content/public/browser/download_danger_type.h" | 13 #include "content/public/browser/download_danger_type.h" |
11 #include "content/public/browser/download_item.h" | 14 #include "content/public/browser/download_item.h" |
12 | 15 |
13 struct DownloadTargetInfo { | 16 struct DownloadTargetInfo { |
14 DownloadTargetInfo(); | 17 DownloadTargetInfo(); |
15 ~DownloadTargetInfo(); | 18 ~DownloadTargetInfo(); |
16 | 19 |
17 // Final full target path of the download. Must be non-empty for the remaining | 20 // Final full target path of the download. Must be non-empty for the remaining |
18 // fields to be considered valid. The path is a local file system path. Any | 21 // fields to be considered valid. The path is a local file system path. Any |
19 // existing file at this path should be overwritten. | 22 // existing file at this path should be overwritten. |
20 base::FilePath target_path; | 23 base::FilePath target_path; |
21 | 24 |
22 // Disposition. This will be TARGET_DISPOSITION_PROMPT if the user was | 25 // Disposition. This will be TARGET_DISPOSITION_PROMPT if the user was |
23 // prompted during the process of determining the download target. Otherwise | 26 // prompted during the process of determining the download target. Otherwise |
24 // it will be TARGET_DISPOSITION_OVERWRITE. | 27 // it will be TARGET_DISPOSITION_OVERWRITE. |
| 28 // TODO(asanka): This should be has_user_confirmation or somesuch that |
| 29 // indicates that the user has seen and confirmed the download path. |
25 content::DownloadItem::TargetDisposition target_disposition; | 30 content::DownloadItem::TargetDisposition target_disposition; |
26 | 31 |
27 // Danger type of the download. | 32 // Danger type of the download. |
28 content::DownloadDangerType danger_type; | 33 content::DownloadDangerType danger_type; |
29 | 34 |
30 // The danger type of the download could be set to MAYBE_DANGEROUS_CONTENT if | 35 // The danger type of the download could be set to MAYBE_DANGEROUS_CONTENT if |
31 // the file type is handled by SafeBrowsing. However, if the SafeBrowsing | 36 // the file type is handled by SafeBrowsing. However, if the SafeBrowsing |
32 // service is unable to verify whether the file is safe or not, we are on our | 37 // service is unable to verify whether the file is safe or not, we are on our |
33 // own. The value of |danger_level| indicates whether the download should be | 38 // own. The value of |danger_level| indicates whether the download should be |
34 // considered dangerous if SafeBrowsing returns an unknown verdict. | 39 // considered dangerous if SafeBrowsing returns an unknown verdict. |
(...skipping 27 matching lines...) Expand all Loading... |
62 // MIME type based on the file type of the download. This may be different | 67 // MIME type based on the file type of the download. This may be different |
63 // from DownloadItem::GetMimeType() since the latter is based on the server | 68 // from DownloadItem::GetMimeType() since the latter is based on the server |
64 // response, and this one is based on the filename. | 69 // response, and this one is based on the filename. |
65 std::string mime_type; | 70 std::string mime_type; |
66 | 71 |
67 // Whether the |target_path| would be handled safely by the browser if it were | 72 // Whether the |target_path| would be handled safely by the browser if it were |
68 // to be opened with a file:// URL. This can be used later to decide how file | 73 // to be opened with a file:// URL. This can be used later to decide how file |
69 // opens should be handled. The file is considered to be handled safely if the | 74 // opens should be handled. The file is considered to be handled safely if the |
70 // filetype is supported by the renderer or a sandboxed plugin. | 75 // filetype is supported by the renderer or a sandboxed plugin. |
71 bool is_filetype_handled_safely; | 76 bool is_filetype_handled_safely; |
| 77 |
| 78 // Result of the download target determination. |
| 79 DownloadTargetResult result; |
72 }; | 80 }; |
73 | 81 |
74 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_TARGET_INFO_H_ | 82 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_TARGET_INFO_H_ |
OLD | NEW |