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

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

Issue 2295323002: Download Drop Down Highlight Doesn't Stay (Closed)
Patch Set: Created 4 years, 4 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
« no previous file with comments | « chrome/browser/ui/views/download/download_shelf_context_menu_view.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 faa4d439a6715c08368c7a140177cba149d78d33..0d5f455949996f29bf834400754459b87dd3a8cb 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
@@ -20,16 +20,18 @@ DownloadShelfContextMenuView::DownloadShelfContextMenuView(
DownloadShelfContextMenuView::~DownloadShelfContextMenuView() {}
-void DownloadShelfContextMenuView::Run(views::Widget* parent_widget,
- const gfx::Rect& rect,
- ui::MenuSourceType source_type) {
+void DownloadShelfContextMenuView::Run(
+ views::Widget* parent_widget,
+ const gfx::Rect& rect,
+ ui::MenuSourceType source_type,
+ const base::Closure& on_menu_closed_callback) {
ui::MenuModel* menu_model = GetMenuModel();
// Run() should not be getting called if the DownloadItem was destroyed.
DCHECK(menu_model);
menu_model_adapter_.reset(new views::MenuModelAdapter(
menu_model, base::Bind(&DownloadShelfContextMenuView::OnMenuClosed,
- base::Unretained(this))));
+ base::Unretained(this), on_menu_closed_callback)));
menu_runner_.reset(new views::MenuRunner(menu_model_adapter_->CreateMenu(),
views::MenuRunner::HAS_MNEMONICS |
@@ -46,8 +48,15 @@ void DownloadShelfContextMenuView::Run(views::Widget* parent_widget,
menu_runner_->RunMenuAt(parent_widget, NULL, rect, position, source_type);
}
-void DownloadShelfContextMenuView::OnMenuClosed() {
+void DownloadShelfContextMenuView::OnMenuClosed(
+ const base::Closure& on_menu_closed_callback) {
close_time_ = base::TimeTicks::Now();
+
+ // This must be ran before clearing |menu_model_adapter_| who owns the
+ // reference.
+ if (!on_menu_closed_callback.is_null())
+ on_menu_closed_callback.Run();
+
menu_model_adapter_.reset();
menu_runner_.reset();
}
« no previous file with comments | « chrome/browser/ui/views/download/download_shelf_context_menu_view.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698