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

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

Issue 2394123002: Views: Expose an on_closed callback via the MenuRunner constructor. (Closed)
Patch Set: default arg Created 4 years, 2 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 0d5f455949996f29bf834400754459b87dd3a8cb..20ab817fe3626c08574537e199a3ed4906434bab 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
@@ -10,7 +10,6 @@
#include "content/public/browser/download_item.h"
#include "content/public/browser/page_navigator.h"
#include "ui/gfx/geometry/point.h"
-#include "ui/views/controls/menu/menu_model_adapter.h"
#include "ui/views/controls/menu/menu_runner.h"
DownloadShelfContextMenuView::DownloadShelfContextMenuView(
@@ -29,14 +28,12 @@ void DownloadShelfContextMenuView::Run(
// 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), on_menu_closed_callback)));
-
- menu_runner_.reset(new views::MenuRunner(menu_model_adapter_->CreateMenu(),
- views::MenuRunner::HAS_MNEMONICS |
- views::MenuRunner::CONTEXT_MENU |
- views::MenuRunner::ASYNC));
+ menu_runner_.reset(new views::MenuRunner(
+ menu_model,
+ views::MenuRunner::HAS_MNEMONICS | views::MenuRunner::CONTEXT_MENU |
+ views::MenuRunner::ASYNC,
+ base::Bind(&DownloadShelfContextMenuView::OnMenuClosed,
+ base::Unretained(this), on_menu_closed_callback)));
// The menu's alignment is determined based on the UI layout.
views::MenuAnchorPosition position;
@@ -52,11 +49,9 @@ 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.
+ // This must be run before clearing |menu_runner_| who owns the reference.
if (!on_menu_closed_callback.is_null())
on_menu_closed_callback.Run();
- menu_model_adapter_.reset();
menu_runner_.reset();
}

Powered by Google App Engine
This is Rietveld 408576698