Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1562)

Unified Diff: chrome/browser/ui/views/download/download_item_view.cc

Issue 8624008: Make malicious content download warning include the download filename (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/gtk/download/download_item_gtk.cc ('k') | chrome/browser/ui/webui/active_downloads_ui.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/views/download/download_item_view.cc
diff --git a/chrome/browser/ui/views/download/download_item_view.cc b/chrome/browser/ui/views/download/download_item_view.cc
index d90f31c7a90f2017f04f86d23463bb5297110835..7622f81ba2a8765e78015c9c0ce8c3d826880f48 100644
--- a/chrome/browser/ui/views/download/download_item_view.cc
+++ b/chrome/browser/ui/views/download/download_item_view.cc
@@ -976,31 +976,37 @@ void DownloadItemView::EnterDangerousMode() {
ResourceBundle& rb = ResourceBundle::GetSharedInstance();
// The dangerous download label text and icon are different
// under different cases.
- string16 dangerous_label;
if (download_->GetDangerType() == DownloadStateInfo::DANGEROUS_URL ||
- download_->GetDangerType() == DownloadStateInfo::DANGEROUS_CONTENT) {
- // TODO(noelutz): add the target filename to the warning message in the
- // case of a dangerous content warning.
- // Safebrowsing shows the download URL or content leads to malicious file.
+ download_->GetDangerType() == DownloadStateInfo::DANGEROUS_CONTENT) {
warning_icon_ = rb.GetBitmapNamed(IDR_SAFEBROWSING_WARNING);
- dangerous_label =
- l10n_util::GetStringUTF16(IDS_PROMPT_UNSAFE_DOWNLOAD_URL);
} else {
- // The download file has dangerous file type (e.g.: an executable).
DCHECK(download_->GetDangerType() == DownloadStateInfo::DANGEROUS_FILE);
warning_icon_ = rb.GetBitmapNamed(IDR_WARNING);
- if (ChromeDownloadManagerDelegate::IsExtensionDownload(download_)) {
- dangerous_label =
- l10n_util::GetStringUTF16(IDS_PROMPT_DANGEROUS_DOWNLOAD_EXTENSION);
- } else {
- ui::ElideString(rootname,
- kFileNameMaxLength - extension.length(),
- &rootname);
- string16 filename = rootname + ASCIIToUTF16(".") + extension;
- filename = base::i18n::GetDisplayStringInLTRDirectionality(filename);
- dangerous_label =
- l10n_util::GetStringFUTF16(IDS_PROMPT_DANGEROUS_DOWNLOAD, filename);
- }
+ }
+ string16 dangerous_label;
+ if (download_->GetDangerType() == DownloadStateInfo::DANGEROUS_URL) {
+ // Safebrowsing shows the download URL or content leads to malicious file.
+ dangerous_label = l10n_util::GetStringUTF16(
+ IDS_PROMPT_MALICIOUS_DOWNLOAD_URL);
+ } else if (download_->GetDangerType() == DownloadStateInfo::DANGEROUS_FILE &&
+ ChromeDownloadManagerDelegate::IsExtensionDownload(download_)) {
+ dangerous_label =
+ l10n_util::GetStringUTF16(IDS_PROMPT_DANGEROUS_DOWNLOAD_EXTENSION);
+ } else {
+ // The download file has dangerous file type (e.g.: an executable) or the
+ // file content is known to be malicious.
+ DCHECK(download_->GetDangerType() == DownloadStateInfo::DANGEROUS_FILE ||
+ download_->GetDangerType() == DownloadStateInfo::DANGEROUS_CONTENT);
+ ui::ElideString(rootname,
+ kFileNameMaxLength - extension.length(),
+ &rootname);
+ string16 filename = rootname + ASCIIToUTF16(".") + extension;
+ filename = base::i18n::GetDisplayStringInLTRDirectionality(filename);
+ dangerous_label = l10n_util::GetStringFUTF16(
+ download_->GetDangerType() == DownloadStateInfo::DANGEROUS_FILE ?
+ IDS_PROMPT_DANGEROUS_DOWNLOAD_EXTENSION :
asanka 2011/11/22 17:07:47 IDS_PROMPT_DANGEROUS_DOWNLOAD
noelutz 2011/11/22 17:32:05 Good catch. Done.
+ IDS_PROMPT_MALICIOUS_DOWNLOAD_CONTENT,
+ filename);
}
dangerous_download_label_ = new views::Label(dangerous_label);
« no previous file with comments | « chrome/browser/ui/gtk/download/download_item_gtk.cc ('k') | chrome/browser/ui/webui/active_downloads_ui.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698