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_avatar_icon_util.h" | 10 #include "chrome/browser/profiles/profile_avatar_icon_util.h" |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 | 53 |
54 void BrowserNonClientFrameView::OnThemeChanged() { | 54 void BrowserNonClientFrameView::OnThemeChanged() { |
55 if (avatar_label_) | 55 if (avatar_label_) |
56 avatar_label_->UpdateLabelStyle(); | 56 avatar_label_->UpdateLabelStyle(); |
57 } | 57 } |
58 | 58 |
59 void BrowserNonClientFrameView::UpdateAvatarInfo() { | 59 void BrowserNonClientFrameView::UpdateAvatarInfo() { |
60 if (browser_view_->ShouldShowAvatar()) { | 60 if (browser_view_->ShouldShowAvatar()) { |
61 if (!avatar_button_) { | 61 if (!avatar_button_) { |
62 Profile* profile = browser_view_->browser()->profile(); | 62 Profile* profile = browser_view_->browser()->profile(); |
63 if (profile->IsManaged() && !avatar_label_) { | 63 if (profile->IsSupervised() && !avatar_label_) { |
64 avatar_label_ = new AvatarLabel(browser_view_); | 64 avatar_label_ = new AvatarLabel(browser_view_); |
65 avatar_label_->set_id(VIEW_ID_AVATAR_LABEL); | 65 avatar_label_->set_id(VIEW_ID_AVATAR_LABEL); |
66 AddChildView(avatar_label_); | 66 AddChildView(avatar_label_); |
67 } | 67 } |
68 avatar_button_ = new AvatarMenuButton( | 68 avatar_button_ = new AvatarMenuButton( |
69 browser_view_->browser(), !browser_view_->IsRegularOrGuestSession()); | 69 browser_view_->browser(), !browser_view_->IsRegularOrGuestSession()); |
70 avatar_button_->set_id(VIEW_ID_AVATAR_BUTTON); | 70 avatar_button_->set_id(VIEW_ID_AVATAR_BUTTON); |
71 AddChildView(avatar_button_); | 71 AddChildView(avatar_button_); |
72 // Invalidate here because adding a child does not invalidate the layout. | 72 // Invalidate here because adding a child does not invalidate the layout. |
73 InvalidateLayout(); | 73 InvalidateLayout(); |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 new_avatar_button_->set_id(VIEW_ID_NEW_AVATAR_BUTTON); | 158 new_avatar_button_->set_id(VIEW_ID_NEW_AVATAR_BUTTON); |
159 AddChildView(new_avatar_button_); | 159 AddChildView(new_avatar_button_); |
160 frame_->GetRootView()->Layout(); | 160 frame_->GetRootView()->Layout(); |
161 } | 161 } |
162 } else if (new_avatar_button_) { | 162 } else if (new_avatar_button_) { |
163 delete new_avatar_button_; | 163 delete new_avatar_button_; |
164 new_avatar_button_ = NULL; | 164 new_avatar_button_ = NULL; |
165 frame_->GetRootView()->Layout(); | 165 frame_->GetRootView()->Layout(); |
166 } | 166 } |
167 } | 167 } |
OLD | NEW |