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

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

Issue 8907001: Update avatar bubble if profile info changes (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: address review comments 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
Index: chrome/browser/ui/views/avatar_menu_bubble_view.cc
diff --git a/chrome/browser/ui/views/avatar_menu_bubble_view.cc b/chrome/browser/ui/views/avatar_menu_bubble_view.cc
index 9f1b0816bbb73414ca795ccb99911cccdf942864..d48fe6350cd93f81571739723d91f510a9d40f95 100644
--- a/chrome/browser/ui/views/avatar_menu_bubble_view.cc
+++ b/chrome/browser/ui/views/avatar_menu_bubble_view.cc
@@ -351,14 +351,15 @@ AvatarMenuBubbleView::AvatarMenuBubbleView(
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_)
Peter Kasting 2011/12/13 02:25:11 Is this really necessary? Normally it's safe to a
sail 2011/12/13 02:31:40 This is currently necessary. I think it's called b
+ 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 @@ bool AvatarMenuBubbleView::AcceleratorPressed(
return true;
}
+void AvatarMenuBubbleView::ViewHierarchyChanged(bool is_add,
+ views::View* parent,
+ views::View* child) {
+ views::BubbleDelegateView::ViewHierarchyChanged(is_add, parent, child);
+
+ // Build the menu for the first time.
Peter Kasting 2011/12/13 02:25:11 Nit: I think normally we do class-specific stuff b
sail 2011/12/13 02:31:40 Done.
+ if (!add_profile_link_ && is_add && child == this)
+ OnAvatarMenuModelChanged(avatar_menu_model_.get());
+}
+
void AvatarMenuBubbleView::ButtonPressed(views::Button* sender,
const views::Event& event) {
for (size_t i = 0; i < item_views_.size(); ++i) {
@@ -497,5 +508,7 @@ void AvatarMenuBubbleView::OnAvatarMenuModelChanged(
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.
Peter Kasting 2011/12/13 02:25:11 It still seems strange to me that we need this. I
sail 2011/12/13 02:31:40 Adding Scott and msw to the review. If this requir
msw 2011/12/13 03:20:23 Doing a synchronous Layout and then calling SizeTo
sky 2011/12/13 05:18:46 We could make whatever the content view is for the
msw 2011/12/13 18:17:47 AvatarMenuBubbleView is the content view (a Bubble
+ Layout();
+ SizeToContents();
}

Powered by Google App Engine
This is Rietveld 408576698