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

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

Issue 11673004: No need to pass DownloadItemModel ownership. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: DownloadShelfContextMenu class cleanup and require GetMenuModel() to return non-NULL Created 7 years, 11 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_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.

Powered by Google App Engine
This is Rietveld 408576698