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

Unified Diff: chrome/browser/ui/views/avatar_menu_bubble_view.cc

Issue 8890092: Merge 114330 - Update avatar bubble if profile info changes (Closed) Base URL: svn://svn.chromium.org/chrome/branches/963/src/
Patch Set: Created 9 years 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/ui/views/avatar_menu_bubble_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/ui/views/avatar_menu_bubble_view.cc
===================================================================
--- chrome/browser/ui/views/avatar_menu_bubble_view.cc (revision 114338)
+++ chrome/browser/ui/views/avatar_menu_bubble_view.cc (working copy)
@@ -351,14 +351,15 @@
avatar_menu_model_.reset(new AvatarMenuModel(
&g_browser_process->profile_manager()->GetProfileInfoCache(),
this, browser_));
- // Build the menu for the first time.
- OnAvatarMenuModelChanged(avatar_menu_model_.get());
}
AvatarMenuBubbleView::~AvatarMenuBubbleView() {
}
gfx::Size AvatarMenuBubbleView::GetPreferredSize() {
+ if (!add_profile_link_)
+ return gfx::Size();
+
int max_width = 0;
int total_height = 0;
for (size_t i = 0; i < item_views_.size(); ++i) {
@@ -431,6 +432,16 @@
return true;
}
+void AvatarMenuBubbleView::ViewHierarchyChanged(bool is_add,
+ views::View* parent,
+ views::View* child) {
+ // Build the menu for the first time.
+ if (!add_profile_link_ && is_add && child == this)
+ OnAvatarMenuModelChanged(avatar_menu_model_.get());
+
+ views::BubbleDelegateView::ViewHierarchyChanged(is_add, parent, child);
+}
+
void AvatarMenuBubbleView::ButtonPressed(views::Button* sender,
const views::Event& event) {
for (size_t i = 0; i < item_views_.size(); ++i) {
@@ -497,5 +508,7 @@
add_profile_link_->SetEnabledColor(SkColorSetRGB(0xe3, 0xed, 0xf6));
AddChildView(add_profile_link_);
- PreferredSizeChanged();
+ // If the bubble has already been shown then resize and reposition the bubble.
+ Layout();
+ SizeToContents();
}
« no previous file with comments | « chrome/browser/ui/views/avatar_menu_bubble_view.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698