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 InvalidateLayout(); | |
oshima
2014/03/14 20:40:44
This is necessary because adding child does not in
Mr4D (OOO till 08-26)
2014/03/14 22:01:30
Thanks for the explanation! It might be good to ad
oshima
2014/03/15 01:32:32
Done.
| |
71 frame_->GetRootView()->Layout(); | 72 frame_->GetRootView()->Layout(); |
72 } | 73 } |
73 } else if (avatar_button_) { | 74 } else if (avatar_button_) { |
74 // The avatar label can just be there if there is also an avatar button. | 75 // The avatar label can just be there if there is also an avatar button. |
75 if (avatar_label_) { | 76 if (avatar_label_) { |
76 RemoveChildView(avatar_label_); | 77 RemoveChildView(avatar_label_); |
77 delete avatar_label_; | 78 delete avatar_label_; |
78 avatar_label_ = NULL; | 79 avatar_label_ = NULL; |
79 } | 80 } |
80 RemoveChildView(avatar_button_); | 81 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); | 155 new_avatar_button_->set_id(VIEW_ID_NEW_AVATAR_BUTTON); |
155 AddChildView(new_avatar_button_); | 156 AddChildView(new_avatar_button_); |
156 frame_->GetRootView()->Layout(); | 157 frame_->GetRootView()->Layout(); |
157 } | 158 } |
158 } else if (new_avatar_button_) { | 159 } else if (new_avatar_button_) { |
159 delete new_avatar_button_; | 160 delete new_avatar_button_; |
160 new_avatar_button_ = NULL; | 161 new_avatar_button_ = NULL; |
161 frame_->GetRootView()->Layout(); | 162 frame_->GetRootView()->Layout(); |
162 } | 163 } |
163 } | 164 } |
OLD | NEW |