| Index: chrome/browser/download/download_item.cc
|
| ===================================================================
|
| --- chrome/browser/download/download_item.cc (revision 86341)
|
| +++ chrome/browser/download/download_item.cc (working copy)
|
| @@ -93,18 +93,20 @@
|
| };
|
| }
|
|
|
| -DownloadItem::SafetyState GetSafetyState(bool dangerous_file,
|
| - bool dangerous_url) {
|
| - return (dangerous_url || dangerous_file) ?
|
| +DownloadItem::SafetyState GetSafetyState(
|
| + bool dangerous_file,
|
| + DownloadStateInfo::Tristate dangerous_url) {
|
| + return ((dangerous_url == DownloadStateInfo::YES) || dangerous_file) ?
|
| DownloadItem::DANGEROUS : DownloadItem::SAFE;
|
| }
|
|
|
| // Note: When a download has both |dangerous_file| and |dangerous_url| set,
|
| // danger type is set to DANGEROUS_URL since the risk of dangerous URL
|
| // overweights that of dangerous file type.
|
| -DownloadItem::DangerType GetDangerType(bool dangerous_file,
|
| - bool dangerous_url) {
|
| - if (dangerous_url) {
|
| +DownloadItem::DangerType GetDangerType(
|
| + bool dangerous_file,
|
| + DownloadStateInfo::Tristate dangerous_url) {
|
| + if (dangerous_url == DownloadStateInfo::YES) {
|
| // dangerous URL overweights dangerous file. We check dangerous URL first.
|
| return DownloadItem::DANGEROUS_URL;
|
| }
|
| @@ -149,8 +151,8 @@
|
| bool is_otr)
|
| : state_info_(info.original_name, info.save_info.file_path,
|
| info.has_user_gesture, info.prompt_user_for_save_location,
|
| - info.path_uniquifier, info.is_dangerous_file,
|
| - info.is_dangerous_url, info.is_extension_install),
|
| + info.path_uniquifier, false, DownloadStateInfo::UNKNOWN,
|
| + DownloadStateInfo::UNKNOWN, info.is_extension_install),
|
| process_handle_(info.process_handle),
|
| download_id_(info.download_id),
|
| full_path_(info.path),
|
| @@ -170,8 +172,7 @@
|
| download_manager_(download_manager),
|
| is_paused_(false),
|
| open_when_complete_(false),
|
| - safety_state_(GetSafetyState(info.is_dangerous_file,
|
| - info.is_dangerous_url)),
|
| + safety_state_(SAFE),
|
| auto_opened_(false),
|
| is_otr_(is_otr),
|
| is_temporary_(!info.save_info.file_path.empty()),
|
| @@ -541,10 +542,20 @@
|
| return GetDangerType() != DownloadItem::NOT_DANGEROUS;
|
| }
|
|
|
| -void DownloadItem::MarkUrlDangerous() {
|
| - state_info_.is_dangerous_url = true;
|
| +void DownloadItem::SetFileDangerous(bool dangerous) {
|
| + state_info_.is_dangerous_file = dangerous;
|
| }
|
|
|
| +void DownloadItem::SetUrlDangerous(bool dangerous) {
|
| + state_info_.is_dangerous_url =
|
| + dangerous ? DownloadStateInfo::YES : DownloadStateInfo::NO;
|
| +}
|
| +
|
| +void DownloadItem::SetVisitedBefore(bool visited_referrer_before) {
|
| + state_info_.visited_referrer_before =
|
| + visited_referrer_before ? DownloadStateInfo::YES : DownloadStateInfo::NO;
|
| +}
|
| +
|
| DownloadHistoryInfo DownloadItem::GetHistoryInfo() const {
|
| return DownloadHistoryInfo(full_path(),
|
| GetURL(),
|
|
|