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

Unified Diff: chrome/browser/ui/views/download/download_item_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 | « no previous file | chrome/browser/ui/views/download/download_item_view_md.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/views/download/download_item_view.cc
diff --git a/chrome/browser/ui/views/download/download_item_view.cc b/chrome/browser/ui/views/download/download_item_view.cc
index 7bd90e053ec34afea533088f816c7df72043efda..45c092bc4182ebc2a733ec797fcc8fcb0affe7a0 100644
--- a/chrome/browser/ui/views/download/download_item_view.cc
+++ b/chrome/browser/ui/views/download/download_item_view.cc
@@ -987,20 +987,14 @@ void DownloadItemView::ShowContextMenuImpl(const gfx::Point& p,
point.SetPoint(drop_down_x_left_, box_y_);
size.SetSize(drop_down_x_right_ - drop_down_x_left_, box_height_);
}
- // 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(&DownloadItemView::ReleaseDropDown,
- weak_ptr_factory_.GetWeakPtr()));
views::View::ConvertPointToScreen(this, &point);
if (!context_menu_.get())
context_menu_.reset(new DownloadShelfContextMenuView(download()));
- context_menu_->Run(GetWidget()->GetTopLevelWidget(),
- gfx::Rect(point, size), source_type);
- // We could be deleted now.
+ context_menu_->Run(GetWidget()->GetTopLevelWidget(), gfx::Rect(point, size),
+ source_type, base::Bind(&DownloadItemView::ReleaseDropDown,
+ weak_ptr_factory_.GetWeakPtr()));
}
void DownloadItemView::HandlePressEvent(const ui::LocatedEvent& event,
« no previous file with comments | « no previous file | chrome/browser/ui/views/download/download_item_view_md.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698