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

Unified Diff: chrome/browser/download/download_shelf_context_menu.cc

Issue 9569011: Refactor dangerous download warning text generation into DownloadItemModel. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Update copyright headers Created 8 years, 10 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/download/download_shelf_context_menu.cc
diff --git a/chrome/browser/download/download_shelf_context_menu.cc b/chrome/browser/download/download_shelf_context_menu.cc
index 7456b8212faf915f5cef1680d3b829e701f97eaa..dd220f39da3a9a80776b26a0a5e1b346c2b6a9e2 100644
--- a/chrome/browser/download/download_shelf_context_menu.cc
+++ b/chrome/browser/download/download_shelf_context_menu.cc
@@ -28,21 +28,16 @@ DownloadShelfContextMenu::DownloadShelfContextMenu(
ui::SimpleMenuModel* DownloadShelfContextMenu::GetMenuModel() {
ui::SimpleMenuModel* model = NULL;
+ // We shouldn't be opening a context menu for a dangerous download, unless it
+ // is a malicious download.
+ DCHECK(!download_model_->IsDangerous() || download_model_->IsMalicious());
- if (download_item_->GetSafetyState() == DownloadItem::DANGEROUS) {
- if (download_item_->GetDangerType() ==
- content::DOWNLOAD_DANGER_TYPE_DANGEROUS_URL ||
- download_item_->GetDangerType() ==
- content::DOWNLOAD_DANGER_TYPE_DANGEROUS_CONTENT) {
- model = GetMaliciousMenuModel();
- } else {
- NOTREACHED();
- }
- } else if (download_item_->IsComplete()) {
+ if (download_model_->IsMalicious())
+ model = GetMaliciousMenuModel();
+ else if (download_item_->IsComplete())
model = GetFinishedMenuModel();
- } else {
+ else
model = GetInProgressMenuModel();
- }
return model;
}
« no previous file with comments | « chrome/browser/download/download_item_model.cc ('k') | chrome/browser/ui/cocoa/download/download_item_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698