| 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 CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_STATE_INFO_H_ | 5 #ifndef CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_STATE_INFO_H_ |
| 6 #define CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_STATE_INFO_H_ | 6 #define CONTENT_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 #include "content/common/page_transition_types.h" |
| 10 | 11 |
| 11 // Contains information relating to the process of determining what to do with | 12 // Contains information relating to the process of determining what to do with |
| 12 // the download. | 13 // the download. |
| 13 struct DownloadStateInfo { | 14 struct DownloadStateInfo { |
| 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, |
| 21 PageTransition::Type transition_type, |
| 20 bool prompt_user_for_save_location, | 22 bool prompt_user_for_save_location, |
| 21 int uniquifier, | 23 int uniquifier, |
| 22 bool dangerous_file, | 24 bool dangerous_file, |
| 23 bool dangerous_url, | 25 bool dangerous_url, |
| 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 |
| 45 PageTransition::Type transition_type; |
| 46 |
| 43 // True if we should display the 'save as...' UI and prompt the user | 47 // True if we should display the 'save as...' UI and prompt the user |
| 44 // for the download location. | 48 // for the download location. |
| 45 // False if the UI should be suppressed and the download performed to the | 49 // False if the UI should be suppressed and the download performed to the |
| 46 // default location. | 50 // default location. |
| 47 bool prompt_user_for_save_location; | 51 bool prompt_user_for_save_location; |
| 48 | 52 |
| 49 // True if this download file is potentially dangerous (ex: exe, dll, ...). | 53 // True if this download file is potentially dangerous (ex: exe, dll, ...). |
| 50 bool is_dangerous_file; | 54 bool is_dangerous_file; |
| 51 | 55 |
| 52 // If safebrowsing believes this URL leads to malware. | 56 // If safebrowsing believes this URL leads to malware. |
| 53 bool is_dangerous_url; | 57 bool is_dangerous_url; |
| 54 | 58 |
| 55 // True if this download is for extension install. | 59 // True if this download is for extension install. |
| 56 bool is_extension_install; | 60 bool is_extension_install; |
| 57 | 61 |
| 58 // True if this download's file name was specified initially. | 62 // True if this download's file name was specified initially. |
| 59 FilePath force_file_name; | 63 FilePath force_file_name; |
| 60 }; | 64 }; |
| 61 | 65 |
| 62 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_STATE_INFO_H_ | 66 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_STATE_INFO_H_ |
| OLD | NEW |