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

Unified Diff: chrome/browser/ui/gtk/download/download_shelf_context_menu_gtk.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/gtk/download/download_shelf_context_menu_gtk.cc
diff --git a/chrome/browser/ui/gtk/download/download_shelf_context_menu_gtk.cc b/chrome/browser/ui/gtk/download/download_shelf_context_menu_gtk.cc
index 1441a937ab800973c24df34dfcff4c22888ee490..75da2df85707828083c7ee420028d16b13f74d67 100644
--- a/chrome/browser/ui/gtk/download/download_shelf_context_menu_gtk.cc
+++ b/chrome/browser/ui/gtk/download/download_shelf_context_menu_gtk.cc
@@ -11,10 +11,9 @@
#include "ui/gfx/point.h"
DownloadShelfContextMenuGtk::DownloadShelfContextMenuGtk(
- DownloadItemModel* model,
DownloadItemGtk* download_item,
content::PageNavigator* navigator)
- : DownloadShelfContextMenu(model, navigator),
+ : DownloadShelfContextMenu(download_item->download(), navigator),
download_item_gtk_(download_item) {
}
@@ -22,7 +21,11 @@ DownloadShelfContextMenuGtk::~DownloadShelfContextMenuGtk() {}
void DownloadShelfContextMenuGtk::Popup(GtkWidget* widget,
GdkEventButton* event) {
- menu_.reset(new MenuGtk(this, GetMenuModel()));
+ ui::SimpleMenuModel* menu_model = GetMenuModel();
+ // Popup() should never be called after the DownloadItem is destroyed.
+ DCHECK(menu_model);
+
+ menu_.reset(new MenuGtk(this, menu_model));
if (widget)
menu_->PopupForWidget(widget, event->button, event->time);
« no previous file with comments | « chrome/browser/ui/gtk/download/download_shelf_context_menu_gtk.h ('k') | chrome/browser/ui/gtk/download/download_shelf_gtk.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698