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