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

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

Issue 19863005: Warn users about potentially unwanted downloads. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add a "Learn more" URL for unwanted downloads. Created 7 years, 5 months 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
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 0bdc6c4ebe939367ad7b6a852e18f6aac271d5d9..6a8c365fd0ee4c7edd4d149d8890f0a97f655d53 100644
--- a/chrome/browser/ui/views/download/download_item_view.cc
+++ b/chrome/browser/ui/views/download/download_item_view.cc
@@ -1084,13 +1084,24 @@ void DownloadItemView::ShowWarningDialog() {
AddChildView(discard_button_);
ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
- // The dangerous download label text and icon are different under
- // different cases.
- if (mode_ == MALICIOUS_MODE) {
- warning_icon_ = rb.GetImageSkiaNamed(IDR_SAFEBROWSING_WARNING);
- } else {
- // The download file has dangerous file type (e.g.: an executable).
- warning_icon_ = rb.GetImageSkiaNamed(IDR_WARNING);
+ switch (download()->GetDangerType()) {
+ case content::DOWNLOAD_DANGER_TYPE_DANGEROUS_URL:
+ case content::DOWNLOAD_DANGER_TYPE_DANGEROUS_CONTENT:
+ case content::DOWNLOAD_DANGER_TYPE_UNCOMMON_CONTENT:
+ case content::DOWNLOAD_DANGER_TYPE_DANGEROUS_HOST:
+ warning_icon_ = rb.GetImageSkiaNamed(IDR_SAFEBROWSING_WARNING);
+ break;
+
+ case content::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS:
+ case content::DOWNLOAD_DANGER_TYPE_MAYBE_DANGEROUS_CONTENT:
+ case content::DOWNLOAD_DANGER_TYPE_USER_VALIDATED:
+ case content::DOWNLOAD_DANGER_TYPE_MAX:
+ NOTREACHED();
+ // fallthrough
+
+ case content::DOWNLOAD_DANGER_TYPE_DANGEROUS_FILE:
+ case content::DOWNLOAD_DANGER_TYPE_POTENTIALLY_UNWANTED:
+ warning_icon_ = rb.GetImageSkiaNamed(IDR_WARNING);
}
string16 dangerous_label = model_.GetWarningText(font_, kTextWidth);
dangerous_download_label_ = new views::Label(dangerous_label);
« no previous file with comments | « chrome/browser/safe_browsing/download_protection_service_unittest.cc ('k') | chrome/browser/ui/webui/downloads_dom_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698