| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/ui/views/frame/browser_non_client_frame_view.h" | 5 #include "chrome/browser/ui/views/frame/browser_non_client_frame_view.h" |
| 6 | 6 |
| 7 #include "chrome/browser/browser_process.h" | 7 #include "chrome/browser/browser_process.h" |
| 8 #include "chrome/browser/profiles/avatar_menu.h" | 8 #include "chrome/browser/profiles/avatar_menu.h" |
| 9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
| 10 #include "chrome/browser/profiles/profile_info_cache.h" | 10 #include "chrome/browser/profiles/profile_info_cache.h" |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 Profile* profile = browser_view_->browser()->profile(); | 61 Profile* profile = browser_view_->browser()->profile(); |
| 62 if (profile->IsManaged() && !avatar_label_) { | 62 if (profile->IsManaged() && !avatar_label_) { |
| 63 avatar_label_ = new AvatarLabel(browser_view_); | 63 avatar_label_ = new AvatarLabel(browser_view_); |
| 64 avatar_label_->set_id(VIEW_ID_AVATAR_LABEL); | 64 avatar_label_->set_id(VIEW_ID_AVATAR_LABEL); |
| 65 AddChildView(avatar_label_); | 65 AddChildView(avatar_label_); |
| 66 } | 66 } |
| 67 avatar_button_ = new AvatarMenuButton( | 67 avatar_button_ = new AvatarMenuButton( |
| 68 browser_view_->browser(), !browser_view_->IsRegularOrGuestSession()); | 68 browser_view_->browser(), !browser_view_->IsRegularOrGuestSession()); |
| 69 avatar_button_->set_id(VIEW_ID_AVATAR_BUTTON); | 69 avatar_button_->set_id(VIEW_ID_AVATAR_BUTTON); |
| 70 AddChildView(avatar_button_); | 70 AddChildView(avatar_button_); |
| 71 // Invalidate here as adding a child does not invalidate layout. |
| 72 InvalidateLayout(); |
| 71 frame_->GetRootView()->Layout(); | 73 frame_->GetRootView()->Layout(); |
| 72 } | 74 } |
| 73 } else if (avatar_button_) { | 75 } else if (avatar_button_) { |
| 74 // The avatar label can just be there if there is also an avatar button. | 76 // The avatar label can just be there if there is also an avatar button. |
| 75 if (avatar_label_) { | 77 if (avatar_label_) { |
| 76 RemoveChildView(avatar_label_); | 78 RemoveChildView(avatar_label_); |
| 77 delete avatar_label_; | 79 delete avatar_label_; |
| 78 avatar_label_ = NULL; | 80 avatar_label_ = NULL; |
| 79 } | 81 } |
| 80 RemoveChildView(avatar_button_); | 82 RemoveChildView(avatar_button_); |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 new_avatar_button_->set_id(VIEW_ID_NEW_AVATAR_BUTTON); | 156 new_avatar_button_->set_id(VIEW_ID_NEW_AVATAR_BUTTON); |
| 155 AddChildView(new_avatar_button_); | 157 AddChildView(new_avatar_button_); |
| 156 frame_->GetRootView()->Layout(); | 158 frame_->GetRootView()->Layout(); |
| 157 } | 159 } |
| 158 } else if (new_avatar_button_) { | 160 } else if (new_avatar_button_) { |
| 159 delete new_avatar_button_; | 161 delete new_avatar_button_; |
| 160 new_avatar_button_ = NULL; | 162 new_avatar_button_ = NULL; |
| 161 frame_->GetRootView()->Layout(); | 163 frame_->GetRootView()->Layout(); |
| 162 } | 164 } |
| 163 } | 165 } |
| OLD | NEW |