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

Unified Diff: chrome/browser/ui/views/frame/opaque_browser_frame_view.cc

Issue 7631027: Multi-Profiles: Add profile avatar if second profile is added (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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 | « chrome/browser/profiles/profile_info_cache.cc ('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/frame/opaque_browser_frame_view.cc
diff --git a/chrome/browser/ui/views/frame/opaque_browser_frame_view.cc b/chrome/browser/ui/views/frame/opaque_browser_frame_view.cc
index 2a702915c4c2edbd82e522dba781a79d4593a638..061344878632cda50cd14f85762b548474b0437c 100644
--- a/chrome/browser/ui/views/frame/opaque_browser_frame_view.cc
+++ b/chrome/browser/ui/views/frame/opaque_browser_frame_view.cc
@@ -201,15 +201,10 @@ OpaqueBrowserFrameView::OpaqueBrowserFrameView(BrowserFrame* frame,
window_icon_->Update();
}
- if (browser_view_->ShouldShowAvatar()) {
- avatar_button_.reset(new AvatarMenuButton(
- browser_view_->browser(), !browser_view_->IsOffTheRecord()));
- AddChildView(avatar_button_.get());
- UpdateAvatarInfo();
- if (!browser_view_->IsOffTheRecord()) {
- registrar_.Add(this, chrome::NOTIFICATION_PROFILE_CACHED_INFO_CHANGED,
- NotificationService::AllSources());
- }
+ UpdateAvatarInfo();
+ if (!browser_view_->IsOffTheRecord()) {
+ registrar_.Add(this, chrome::NOTIFICATION_PROFILE_CACHED_INFO_CHANGED,
+ NotificationService::AllSources());
}
}
@@ -514,7 +509,6 @@ void OpaqueBrowserFrameView::Observe(int type,
switch (type) {
case chrome::NOTIFICATION_PROFILE_CACHED_INFO_CHANGED:
UpdateAvatarInfo();
- LayoutAvatar();
break;
default:
NOTREACHED() << "Got a notification we didn't register for!";
@@ -1153,6 +1147,21 @@ gfx::Rect OpaqueBrowserFrameView::CalculateClientAreaBounds(int width,
}
void OpaqueBrowserFrameView::UpdateAvatarInfo() {
+ if (browser_view_->ShouldShowAvatar()) {
+ if (!avatar_button_.get()) {
+ avatar_button_.reset(new AvatarMenuButton(
+ browser_view_->browser(), !browser_view_->IsOffTheRecord()));
+ AddChildView(avatar_button_.get());
+ frame_->GetRootView()->Layout();
+ }
+ } else if (avatar_button_.get()) {
+ RemoveChildView(avatar_button_.release());
+ frame_->GetRootView()->Layout();
+ }
+
+ if (!avatar_button_.get())
+ return;
+
if (browser_view_->IsOffTheRecord()) {
avatar_button_->SetIcon(browser_view_->GetOTRAvatarIcon());
} else {
« no previous file with comments | « chrome/browser/profiles/profile_info_cache.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698