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

Unified Diff: chrome/browser/ui/views/download/download_item_view_md.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
Index: chrome/browser/ui/views/download/download_item_view_md.cc
diff --git a/chrome/browser/ui/views/download/download_item_view_md.cc b/chrome/browser/ui/views/download/download_item_view_md.cc
index 87200361f164b791178b55d132a64166b00e6085..55c4500bb8bbc2770ea613148a706c2496023bc2 100644
--- a/chrome/browser/ui/views/download/download_item_view_md.cc
+++ b/chrome/browser/ui/views/download/download_item_view_md.cc
@@ -827,17 +827,11 @@ void DownloadItemViewMd::ShowContextMenuImpl(const gfx::Rect& rect,
static_cast<views::internal::RootView*>(GetWidget()->GetRootView())
->SetMouseHandler(NULL);
- // Post a task to release the button. When we call the Run method on the menu
- // below, it runs an inner message loop that might cause us to be deleted.
- // Posting a task with a WeakPtr lets us safely handle the button release.
- base::ThreadTaskRunnerHandle::Get()->PostNonNestableTask(
- FROM_HERE, base::Bind(&DownloadItemViewMd::ReleaseDropdown,
- weak_ptr_factory_.GetWeakPtr()));
-
if (!context_menu_.get())
context_menu_.reset(new DownloadShelfContextMenuView(download()));
- context_menu_->Run(GetWidget()->GetTopLevelWidget(), rect, source_type);
- // We could be deleted now.
+ context_menu_->Run(GetWidget()->GetTopLevelWidget(), rect, source_type,
+ base::Bind(&DownloadItemViewMd::ReleaseDropdown,
+ weak_ptr_factory_.GetWeakPtr()));
}
void DownloadItemViewMd::HandlePressEvent(const ui::LocatedEvent& event,

Powered by Google App Engine
This is Rietveld 408576698