| 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 #include "content/browser/download/download_state_info.h" | 5 #include "content/browser/download/download_state_info.h" |
| 6 | 6 |
| 7 #include "content/public/browser/download_item.h" | 7 #include "content/public/browser/download_item.h" |
| 8 | 8 |
| 9 DownloadStateInfo::DownloadStateInfo() | 9 DownloadStateInfo::DownloadStateInfo() |
| 10 : path_uniquifier(0), | 10 : path_uniquifier(0), |
| 11 has_user_gesture(false), | 11 has_user_gesture(false), |
| 12 transition_type(content::PAGE_TRANSITION_LINK), | 12 transition_type(content::PAGE_TRANSITION_LINK), |
| 13 prompt_user_for_save_location(false), | 13 prompt_user_for_save_location(false), |
| 14 danger(content::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS) { | 14 danger(content::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS) { |
| 15 } | 15 } |
| 16 | 16 |
| 17 DownloadStateInfo::DownloadStateInfo( | 17 DownloadStateInfo::DownloadStateInfo(const FilePath& forced_name, |
| 18 bool has_user_gesture, | 18 bool has_user_gesture, |
| 19 bool prompt_user_for_save_location) | 19 content::PageTransition transition_type, |
| 20 bool prompt_user_for_save_location) |
| 20 : path_uniquifier(0), | 21 : path_uniquifier(0), |
| 21 has_user_gesture(has_user_gesture), | 22 has_user_gesture(has_user_gesture), |
| 22 transition_type(content::PAGE_TRANSITION_LINK), | |
| 23 prompt_user_for_save_location(prompt_user_for_save_location), | |
| 24 danger(content::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS) { | |
| 25 } | |
| 26 | |
| 27 DownloadStateInfo::DownloadStateInfo( | |
| 28 const FilePath& target, | |
| 29 const FilePath& forced_name, | |
| 30 bool has_user_gesture, | |
| 31 content::PageTransition transition_type, | |
| 32 bool prompt_user_for_save_location) | |
| 33 : target_name(target), | |
| 34 path_uniquifier(0), | |
| 35 has_user_gesture(has_user_gesture), | |
| 36 transition_type(transition_type), | 23 transition_type(transition_type), |
| 37 prompt_user_for_save_location(prompt_user_for_save_location), | 24 prompt_user_for_save_location(prompt_user_for_save_location), |
| 38 danger(content::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS), | 25 danger(content::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS), |
| 39 force_file_name(forced_name) { | 26 force_file_name(forced_name) { |
| 40 } | 27 } |
| 41 | 28 |
| 42 bool DownloadStateInfo::IsDangerous() const { | 29 bool DownloadStateInfo::IsDangerous() const { |
| 43 // TODO(noelutz): At this point only the windows views UI supports | 30 // TODO(noelutz): At this point only the windows views UI supports |
| 44 // warnings based on dangerous content. | 31 // warnings based on dangerous content. |
| 45 #ifdef OS_WIN | 32 #ifdef OS_WIN |
| 46 return (danger == content::DOWNLOAD_DANGER_TYPE_DANGEROUS_FILE || | 33 return (danger == content::DOWNLOAD_DANGER_TYPE_DANGEROUS_FILE || |
| 47 danger == content::DOWNLOAD_DANGER_TYPE_DANGEROUS_URL || | 34 danger == content::DOWNLOAD_DANGER_TYPE_DANGEROUS_URL || |
| 48 danger == content::DOWNLOAD_DANGER_TYPE_DANGEROUS_CONTENT); | 35 danger == content::DOWNLOAD_DANGER_TYPE_DANGEROUS_CONTENT); |
| 49 #else | 36 #else |
| 50 return (danger == content::DOWNLOAD_DANGER_TYPE_DANGEROUS_FILE || | 37 return (danger == content::DOWNLOAD_DANGER_TYPE_DANGEROUS_FILE || |
| 51 danger == content::DOWNLOAD_DANGER_TYPE_DANGEROUS_URL); | 38 danger == content::DOWNLOAD_DANGER_TYPE_DANGEROUS_URL); |
| 52 #endif | 39 #endif |
| 53 } | 40 } |
| OLD | NEW |