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

Unified Diff: chrome/browser/ui/views/bookmarks/bookmark_context_menu.cc

Issue 7720012: Moves ownership of MenuItemView to MenuRunner as well as responbility (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix unit test Created 9 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/bookmarks/bookmark_context_menu.cc
diff --git a/chrome/browser/ui/views/bookmarks/bookmark_context_menu.cc b/chrome/browser/ui/views/bookmarks/bookmark_context_menu.cc
index 0a4633fcb4fe01f4942c18bf697c7fb7ae8ceb01..e90810578b9a6c4cb4276fb6079c2149901b68bd 100644
--- a/chrome/browser/ui/views/bookmarks/bookmark_context_menu.cc
+++ b/chrome/browser/ui/views/bookmarks/bookmark_context_menu.cc
@@ -14,6 +14,7 @@
#include "grit/generated_resources.h"
#include "ui/base/l10n/l10n_util.h"
#include "views/controls/menu/menu_item_view.h"
+#include "views/controls/menu/menu_runner.h"
#include "views/widget/widget.h"
////////////////////////////////////////////////////////////////////////////////
@@ -31,6 +32,7 @@ BookmarkContextMenu::BookmarkContextMenu(
this, profile, page_navigator, parent, selection))),
parent_widget_(parent_widget),
ALLOW_THIS_IN_INITIALIZER_LIST(menu_(new views::MenuItemView(this))),
+ menu_runner_(new views::MenuRunner(menu_)),
parent_node_(parent),
observer_(NULL),
close_on_remove_(close_on_remove) {
@@ -46,10 +48,12 @@ void BookmarkContextMenu::RunMenuAt(const gfx::Point& point) {
Source<BookmarkContextMenu>(this),
NotificationService::NoDetails());
// width/height don't matter here.
- views::MenuItemView::AnchorPosition anchor = base::i18n::IsRTL() ?
- views::MenuItemView::TOPRIGHT : views::MenuItemView::TOPLEFT;
- menu_->RunMenuAt(parent_widget_, NULL, gfx::Rect(point.x(), point.y(), 0, 0),
- anchor, true);
+ if (menu_runner_->RunMenuAt(
+ parent_widget_, NULL, gfx::Rect(point.x(), point.y(), 0, 0),
+ views::MenuItemView::TOPLEFT,
+ (views::MenuRunner::HAS_MNEMONICS | views::MenuRunner::IS_NESTED)) ==
+ views::MenuRunner::MENU_DELETED)
+ return;
}
////////////////////////////////////////////////////////////////////////////////

Powered by Google App Engine
This is Rietveld 408576698