Chromium Code Reviews| Index: chrome/browser/ui/views/profiles/new_avatar_button.cc |
| diff --git a/chrome/browser/ui/views/profiles/new_avatar_button.cc b/chrome/browser/ui/views/profiles/new_avatar_button.cc |
| index 5595166ecc4eaa3daeb22986f90b57078e493ce8..33a9a9ed621c22676fda72427f12f6c7d4b51620 100644 |
| --- a/chrome/browser/ui/views/profiles/new_avatar_button.cc |
| +++ b/chrome/browser/ui/views/profiles/new_avatar_button.cc |
| @@ -9,6 +9,7 @@ |
| #include "base/win/windows_version.h" |
| #include "build/build_config.h" |
| #include "chrome/browser/browser_process.h" |
| +#include "chrome/browser/profiles/profile_attributes_entry.h" |
| #include "chrome/browser/profiles/profile_manager.h" |
| #include "chrome/browser/profiles/profiles_state.h" |
| #include "chrome/browser/ui/browser.h" |
| @@ -100,7 +101,8 @@ NewAvatarButton::NewAvatarButton(views::ButtonListener* listener, |
| *rb->GetImageNamed(IDR_AVATAR_NATIVE_BUTTON_AVATAR).ToImageSkia(); |
| } |
| - g_browser_process->profile_manager()->GetProfileInfoCache().AddObserver(this); |
| + g_browser_process->profile_manager()-> |
| + GetProfileAttributesStorage().AddObserver(this); |
| // Subscribe to authentication error changes so that the avatar button can |
| // update itself. Note that guest mode profiles won't have a token service. |
| @@ -117,7 +119,7 @@ NewAvatarButton::NewAvatarButton(views::ButtonListener* listener, |
| NewAvatarButton::~NewAvatarButton() { |
| g_browser_process->profile_manager()-> |
| - GetProfileInfoCache().RemoveObserver(this); |
| + GetProfileAttributesStorage().RemoveObserver(this); |
| SigninErrorController* error = |
| profiles::GetSigninErrorController(browser_->profile()); |
| if (error) |
| @@ -184,15 +186,15 @@ void NewAvatarButton::OnErrorChanged() { |
| } |
| void NewAvatarButton::Update() { |
| - const ProfileInfoCache& cache = |
| - g_browser_process->profile_manager()->GetProfileInfoCache(); |
| + ProfileAttributesStorage& storage = |
| + g_browser_process->profile_manager()->GetProfileAttributesStorage(); |
| // If we have a single local profile, then use the generic avatar |
| // button instead of the profile name. Never use the generic button if |
| // the active profile is Guest. |
| bool use_generic_button = (!browser_->profile()->IsGuestSession() && |
|
Peter Kasting
2016/02/16 20:49:54
Wrapping/indenting here is now strange
lwchkg
2016/02/17 17:09:31
I see. Let's see if the new version (the ! is wrap
Peter Kasting
2016/02/17 22:16:26
Yeah, looks much better.
|
| - cache.GetNumberOfProfiles() == 1 && |
| - !cache.ProfileIsAuthenticatedAtIndex(0)); |
| + storage.GetNumberOfProfiles() == 1 && |
| + !(*storage.GetAllProfilesAttributes().begin())->IsAuthenticated()); |
|
lwchkg
2016/02/14 17:07:18
begin() will be changed to cbegin() in the next pa
Peter Kasting
2016/02/16 20:49:54
Nit: Just use front() instead:
!storage.Get
|
| SetText(use_generic_button ? base::string16() : |
| profiles::GetAvatarButtonTextForProfile(browser_->profile())); |