| 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/browser/download/download_item.h" | 7 #include "content/browser/download/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 is_dangerous_file(false), | 14 danger(NOT_DANGEROUS) { |
| 15 is_dangerous_url(false) { | |
| 16 } | 15 } |
| 17 | 16 |
| 18 DownloadStateInfo::DownloadStateInfo( | 17 DownloadStateInfo::DownloadStateInfo( |
| 19 bool has_user_gesture, | 18 bool has_user_gesture, |
| 20 bool prompt_user_for_save_location) | 19 bool prompt_user_for_save_location) |
| 21 : path_uniquifier(0), | 20 : path_uniquifier(0), |
| 22 has_user_gesture(has_user_gesture), | 21 has_user_gesture(has_user_gesture), |
| 23 transition_type(content::PAGE_TRANSITION_LINK), | 22 transition_type(content::PAGE_TRANSITION_LINK), |
| 24 prompt_user_for_save_location(prompt_user_for_save_location), | 23 prompt_user_for_save_location(prompt_user_for_save_location), |
| 25 is_dangerous_file(false), | 24 danger(NOT_DANGEROUS) { |
| 26 is_dangerous_url(false) { | |
| 27 } | 25 } |
| 28 | 26 |
| 29 DownloadStateInfo::DownloadStateInfo( | 27 DownloadStateInfo::DownloadStateInfo( |
| 30 const FilePath& target, | 28 const FilePath& target, |
| 31 const FilePath& forced_name, | 29 const FilePath& forced_name, |
| 32 bool has_user_gesture, | 30 bool has_user_gesture, |
| 33 content::PageTransition transition_type, | 31 content::PageTransition transition_type, |
| 34 bool prompt_user_for_save_location, | 32 bool prompt_user_for_save_location, |
| 35 int uniquifier, | 33 int uniquifier, |
| 36 bool dangerous_file, | 34 DangerType danger_type) |
| 37 bool dangerous_url) | |
| 38 : target_name(target), | 35 : target_name(target), |
| 39 path_uniquifier(uniquifier), | 36 path_uniquifier(uniquifier), |
| 40 has_user_gesture(has_user_gesture), | 37 has_user_gesture(has_user_gesture), |
| 41 transition_type(transition_type), | 38 transition_type(transition_type), |
| 42 prompt_user_for_save_location(prompt_user_for_save_location), | 39 prompt_user_for_save_location(prompt_user_for_save_location), |
| 43 is_dangerous_file(dangerous_file), | 40 danger(danger_type), |
| 44 is_dangerous_url(dangerous_url), | |
| 45 force_file_name(forced_name) { | 41 force_file_name(forced_name) { |
| 46 } | 42 } |
| 47 | 43 |
| 48 bool DownloadStateInfo::IsDangerous() const { | 44 bool DownloadStateInfo::IsDangerous() const { |
| 49 return is_dangerous_url || is_dangerous_file; | 45 // TODO(noelutz): At this point we can't mark the download as dangerous |
| 46 // if it's content is dangerous because the UI doesn't yet support it. |
| 47 // Once the UI has been changed we should return true when the danger |
| 48 // type is set to DANGEROUS_CONTENT. |
| 49 // |dangerous_content| is true. |
| 50 return (danger == DANGEROUS_FILE || |
| 51 danger == DANGEROUS_URL); |
| 50 } | 52 } |
| OLD | NEW |