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

Unified Diff: ui/views/examples/tree_view_example.cc

Issue 2264403006: Update ui/views menus to use async (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Review Updates 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 | « ui/views/examples/tree_view_example.h ('k') | ui/views/test/combobox_test_api.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/examples/tree_view_example.cc
diff --git a/ui/views/examples/tree_view_example.cc b/ui/views/examples/tree_view_example.cc
index 9681ede1559422704d3ffbf79d7ca29ac13a3166..0c31ce5337db6bd5b06fa153c305d0613a9a74ca 100644
--- a/ui/views/examples/tree_view_example.cc
+++ b/ui/views/examples/tree_view_example.cc
@@ -130,19 +130,15 @@ bool TreeViewExample::CanEdit(TreeView* tree_view,
void TreeViewExample::ShowContextMenuForView(View* source,
const gfx::Point& point,
ui::MenuSourceType source_type) {
- ui::SimpleMenuModel context_menu_model(this);
- context_menu_model.AddItem(ID_EDIT, ASCIIToUTF16("Edit"));
- context_menu_model.AddItem(ID_REMOVE, ASCIIToUTF16("Remove"));
- context_menu_model.AddItem(ID_ADD, ASCIIToUTF16("Add"));
- context_menu_runner_.reset(new MenuRunner(&context_menu_model, 0));
- if (context_menu_runner_->RunMenuAt(source->GetWidget(),
- NULL,
- gfx::Rect(point, gfx::Size()),
- MENU_ANCHOR_TOPLEFT,
- source_type) ==
- MenuRunner::MENU_DELETED) {
- return;
- }
+ context_menu_model_.reset(new ui::SimpleMenuModel(this));
+ context_menu_model_->AddItem(ID_EDIT, ASCIIToUTF16("Edit"));
+ context_menu_model_->AddItem(ID_REMOVE, ASCIIToUTF16("Remove"));
+ context_menu_model_->AddItem(ID_ADD, ASCIIToUTF16("Add"));
+ context_menu_runner_.reset(
+ new MenuRunner(context_menu_model_.get(), MenuRunner::ASYNC));
+ context_menu_runner_->RunMenuAt(source->GetWidget(), nullptr,
+ gfx::Rect(point, gfx::Size()),
+ MENU_ANCHOR_TOPLEFT, source_type);
}
bool TreeViewExample::IsCommandIdChecked(int command_id) const {
« no previous file with comments | « ui/views/examples/tree_view_example.h ('k') | ui/views/test/combobox_test_api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698