Index: chrome/browser/ui/views/download/download_shelf_context_menu_view.cc |
diff --git a/chrome/browser/ui/views/download/download_shelf_context_menu_view.cc b/chrome/browser/ui/views/download/download_shelf_context_menu_view.cc |
index 8191673f005b275478fee0d97243c0ff30adb24a..a38fd947a8f62b114cb3b22b3e12cfd452faadfe 100644 |
--- a/chrome/browser/ui/views/download/download_shelf_context_menu_view.cc |
+++ b/chrome/browser/ui/views/download/download_shelf_context_menu_view.cc |
@@ -15,16 +15,20 @@ |
#include "ui/views/controls/menu/menu_runner.h" |
DownloadShelfContextMenuView::DownloadShelfContextMenuView( |
- DownloadItemModel* model, |
+ content::DownloadItem* download_item, |
content::PageNavigator* navigator) |
- : DownloadShelfContextMenu(model, navigator) { |
+ : DownloadShelfContextMenu(download_item, navigator) { |
} |
DownloadShelfContextMenuView::~DownloadShelfContextMenuView() {} |
void DownloadShelfContextMenuView::Run(views::Widget* parent_widget, |
const gfx::Rect& rect) { |
- views::MenuModelAdapter menu_model_adapter(GetMenuModel()); |
+ ui::MenuModel* menu_model = GetMenuModel(); |
+ // Run() should not be getting called if the DownloadItem was destroyed. |
+ DCHECK(menu_model); |
+ |
+ views::MenuModelAdapter menu_model_adapter(menu_model); |
menu_runner_.reset(new views::MenuRunner(menu_model_adapter.CreateMenu())); |
// The menu's alignment is determined based on the UI layout. |