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 #ifndef CHROME_BROWSER_DOWNLOAD_DOWNLOAD_STATE_INFO_H_ | 5 #ifndef CHROME_BROWSER_DOWNLOAD_DOWNLOAD_STATE_INFO_H_ |
6 #define CHROME_BROWSER_DOWNLOAD_DOWNLOAD_STATE_INFO_H_ | 6 #define CHROME_BROWSER_DOWNLOAD_DOWNLOAD_STATE_INFO_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/file_path.h" | 9 #include "base/file_path.h" |
10 | 10 |
11 // Contains information relating to the process of determining what to do with | 11 // Contains information relating to the process of determining what to do with |
12 // the download. | 12 // the download. |
13 struct DownloadStateInfo { | 13 struct DownloadStateInfo { |
| 14 enum Tristate { NO = 0, YES, UNKNOWN, }; |
14 DownloadStateInfo(); | 15 DownloadStateInfo(); |
15 DownloadStateInfo(bool has_user_gesture, | 16 DownloadStateInfo(bool has_user_gesture, |
16 bool prompt_user_for_save_location); | 17 bool prompt_user_for_save_location); |
17 DownloadStateInfo(const FilePath& target, | 18 DownloadStateInfo(const FilePath& target, |
18 const FilePath& forced_name, | 19 const FilePath& forced_name, |
19 bool has_user_gesture, | 20 bool has_user_gesture, |
20 bool prompt_user_for_save_location, | 21 bool prompt_user_for_save_location, |
21 int uniquifier, | 22 int uniquifier, |
22 bool dangerous_file, | 23 bool dangerous_file, |
23 bool dangerous_url, | 24 Tristate dangerous_url, |
| 25 Tristate visited_referrer_before, |
24 bool extension_install); | 26 bool extension_install); |
25 | 27 |
26 // Indicates if the download is dangerous. | 28 // Indicates if the download is dangerous. |
27 bool IsDangerous() const; | 29 bool IsDangerous() const; |
28 | 30 |
29 // The original name for a dangerous download, specified by the request. | 31 // The original name for a dangerous download, specified by the request. |
30 FilePath target_name; | 32 FilePath target_name; |
31 | 33 |
32 // The path where we save the download. Typically generated. | 34 // The path where we save the download. Typically generated. |
33 FilePath suggested_path; | 35 FilePath suggested_path; |
34 | 36 |
35 // A number that should be added to the suggested path to make it unique. | 37 // A number that should be added to the suggested path to make it unique. |
36 // 0 means no number should be appended. It is eventually incorporated | 38 // 0 means no number should be appended. It is eventually incorporated |
37 // into the final file name. | 39 // into the final file name. |
38 int path_uniquifier; | 40 int path_uniquifier; |
39 | 41 |
40 // True if the download is the result of user action. | 42 // True if the download is the result of user action. |
41 bool has_user_gesture; | 43 bool has_user_gesture; |
42 | 44 |
43 // True if we should display the 'save as...' UI and prompt the user | 45 // True if we should display the 'save as...' UI and prompt the user |
44 // for the download location. | 46 // for the download location. |
45 // False if the UI should be suppressed and the download performed to the | 47 // False if the UI should be suppressed and the download performed to the |
46 // default location. | 48 // default location. |
47 bool prompt_user_for_save_location; | 49 bool prompt_user_for_save_location; |
48 | 50 |
49 // True if this download file is potentially dangerous (ex: exe, dll, ...). | 51 // True if this download file is potentially dangerous (ex: exe, dll, ...). |
50 bool is_dangerous_file; | 52 bool is_dangerous_file; |
51 | 53 |
52 // If safebrowsing believes this URL leads to malware. | 54 // If safebrowsing believes this URL leads to malware. |
53 bool is_dangerous_url; | 55 Tristate is_dangerous_url; |
| 56 |
| 57 // If the user has visited the page hosting the download before today. |
| 58 Tristate visited_referrer_before; |
54 | 59 |
55 // True if this download is for extension install. | 60 // True if this download is for extension install. |
56 bool is_extension_install; | 61 bool is_extension_install; |
57 | 62 |
58 // True if this download's file name was specified initially. | 63 // True if this download's file name was specified initially. |
59 FilePath force_file_name; | 64 FilePath force_file_name; |
60 }; | 65 }; |
61 | 66 |
62 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_STATE_INFO_H_ | 67 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_STATE_INFO_H_ |
OLD | NEW |