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

Unified Diff: views/controls/menu/submenu_view.cc

Issue 7491083: Implemented nicer battery status (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Review fix 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
« no previous file with comments | « views/controls/menu/submenu_view.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: views/controls/menu/submenu_view.cc
diff --git a/views/controls/menu/submenu_view.cc b/views/controls/menu/submenu_view.cc
index 5664a8d32c6d6167f50bc56fdbce76eb3b6690b3..a68568d36cce16ef9bdb395b76fc7a9e2341aee1 100644
--- a/views/controls/menu/submenu_view.cc
+++ b/views/controls/menu/submenu_view.cc
@@ -38,7 +38,8 @@ SubmenuView::SubmenuView(MenuItemView* parent)
drop_position_(MenuDelegate::DROP_NONE),
scroll_view_container_(NULL),
max_accelerator_width_(0),
- minimum_preferred_width_(0) {
+ minimum_preferred_width_(0),
+ resize_open_menu_(false) {
DCHECK(parent);
// We'll delete ourselves, otherwise the ScrollView would delete us on close.
set_parent_owned(false);
@@ -72,6 +73,20 @@ MenuItemView* SubmenuView::GetMenuItemAt(int index) {
return NULL;
}
+void SubmenuView::ChildPreferredSizeChanged(View* child) {
+ if (!resize_open_menu_)
+ return;
+
+ MenuItemView *item = GetMenuItem();
+ MenuController* controller = item->GetMenuController();
+
+ if (controller) {
+ bool dir;
+ gfx::Rect bounds = controller->CalculateMenuBounds(item, false, &dir);
+ Reposition(bounds);
+ }
+}
+
void SubmenuView::Layout() {
// We're in a ScrollView, and need to set our width/height ourselves.
if (!parent())
« no previous file with comments | « views/controls/menu/submenu_view.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698