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 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 | 139 |
140 void BrowserNonClientFrameView::UpdateNewStyleAvatarInfo( | 140 void BrowserNonClientFrameView::UpdateNewStyleAvatarInfo( |
141 views::ButtonListener* listener, | 141 views::ButtonListener* listener, |
142 const NewAvatarButton::AvatarButtonStyle style) { | 142 const NewAvatarButton::AvatarButtonStyle style) { |
143 DCHECK(switches::IsNewAvatarMenu()); | 143 DCHECK(switches::IsNewAvatarMenu()); |
144 // This should never be called in incognito mode. | 144 // This should never be called in incognito mode. |
145 DCHECK(browser_view_->IsRegularOrGuestSession()); | 145 DCHECK(browser_view_->IsRegularOrGuestSession()); |
146 | 146 |
147 if (browser_view_->ShouldShowAvatar()) { | 147 if (browser_view_->ShouldShowAvatar()) { |
148 if (!new_avatar_button_) { | 148 if (!new_avatar_button_) { |
149 base::string16 profile_name = profiles::GetAvatarNameForProfile( | 149 new_avatar_button_ = |
150 browser_view_->browser()->profile()->GetPath()); | 150 new NewAvatarButton(listener, style, browser_view_->browser()); |
151 new_avatar_button_ = new NewAvatarButton( | |
152 listener, profile_name, style, browser_view_->browser()); | |
153 new_avatar_button_->set_id(VIEW_ID_NEW_AVATAR_BUTTON); | 151 new_avatar_button_->set_id(VIEW_ID_NEW_AVATAR_BUTTON); |
154 AddChildView(new_avatar_button_); | 152 AddChildView(new_avatar_button_); |
155 frame_->GetRootView()->Layout(); | 153 frame_->GetRootView()->Layout(); |
156 } | 154 } |
157 } else if (new_avatar_button_) { | 155 } else if (new_avatar_button_) { |
158 delete new_avatar_button_; | 156 delete new_avatar_button_; |
159 new_avatar_button_ = NULL; | 157 new_avatar_button_ = NULL; |
160 frame_->GetRootView()->Layout(); | 158 frame_->GetRootView()->Layout(); |
161 } | 159 } |
162 } | 160 } |
OLD | NEW |