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

Unified Diff: chrome/browser/chromeos/notifications/balloon_view.cc

Issue 7003121: Replace ChromiumOS BalloonView Menu2 with MenuItemView. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Use top level widget and rebase to trunk. Created 9 years, 6 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 | « chrome/browser/chromeos/notifications/balloon_view.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chromeos/notifications/balloon_view.cc
diff --git a/chrome/browser/chromeos/notifications/balloon_view.cc b/chrome/browser/chromeos/notifications/balloon_view.cc
index b6cf1abb706bab46083f6be36b6f73b1eb497fb7..82ecd302b60e1c2e69cf473f7d9c19a64d36b2ef 100644
--- a/chrome/browser/chromeos/notifications/balloon_view.cc
+++ b/chrome/browser/chromeos/notifications/balloon_view.cc
@@ -31,7 +31,8 @@
#include "views/controls/button/image_button.h"
#include "views/controls/button/menu_button.h"
#include "views/controls/label.h"
-#include "views/controls/menu/menu_2.h"
+#include "views/controls/menu/menu_item_view.h"
+#include "views/controls/menu/menu_model_adapter.h"
#include "views/controls/menu/view_menu_delegate.h"
#include "views/widget/widget.h"
@@ -61,7 +62,6 @@ class NotificationControlView : public views::View,
: balloon_view_(view),
close_button_(NULL),
options_menu_contents_(NULL),
- options_menu_menu_(NULL),
options_menu_button_(NULL) {
// TODO(oshima): make background transparent.
set_background(views::Background::CreateSolidBackground(SK_ColorWHITE));
@@ -117,7 +117,21 @@ class NotificationControlView : public views::View,
// views::ViewMenuDelegate implements.
virtual void RunMenu(views::View* source, const gfx::Point& pt) {
CreateOptionsMenu();
- options_menu_menu_->RunMenuAt(pt, views::Menu2::ALIGN_TOPRIGHT);
+
+ views::MenuModelAdapter menu_model_adapter(options_menu_contents_.get());
+ views::MenuItemView menu(&menu_model_adapter);
+ menu_model_adapter.BuildMenu(&menu);
oshima 2011/07/06 18:10:36 I felt this API a bit wired because you create men
rhashimoto 2011/07/06 18:27:33 I agree that it is a little strange. The model se
+
+ gfx::Point screen_location;
+ views::View::ConvertPointToScreen(options_menu_button_,
+ &screen_location);
+ gfx::NativeWindow window =
+ source->GetWidget()->GetTopLevelWidget()->GetNativeWindow();
+ menu.RunMenuAt(window,
+ options_menu_button_,
+ gfx::Rect(screen_location, options_menu_button_->size()),
+ views::MenuItemView::TOPRIGHT,
+ true);
}
// views::ButtonListener implements.
@@ -167,8 +181,6 @@ class NotificationControlView : public views::View,
// Figure out where to show the source info.
options_menu_contents_->AddItem(kNoopCommand, source_label_text);
options_menu_contents_->AddItem(kRevokePermissionCommand, label_text);
-
- options_menu_menu_.reset(new views::Menu2(options_menu_contents_.get()));
}
BalloonViewImpl* balloon_view_;
@@ -177,7 +189,6 @@ class NotificationControlView : public views::View,
// The options menu.
scoped_ptr<ui::SimpleMenuModel> options_menu_contents_;
- scoped_ptr<views::Menu2> options_menu_menu_;
views::MenuButton* options_menu_button_;
DISALLOW_COPY_AND_ASSIGN(NotificationControlView);
« no previous file with comments | « chrome/browser/chromeos/notifications/balloon_view.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698