| Index: chrome/browser/profiles/gaia_info_update_service.cc
|
| diff --git a/chrome/browser/profiles/gaia_info_update_service.cc b/chrome/browser/profiles/gaia_info_update_service.cc
|
| index f75fc93de4c045d741d31bbacc401cbbf67c9efa..7bc29fea58096d60a3b87a823c6a46f0a8867735 100644
|
| --- a/chrome/browser/profiles/gaia_info_update_service.cc
|
| +++ b/chrome/browser/profiles/gaia_info_update_service.cc
|
| @@ -11,7 +11,8 @@
|
| #include "chrome/browser/browser_process.h"
|
| #include "chrome/browser/chrome_notification_types.h"
|
| #include "chrome/browser/profiles/profile.h"
|
| -#include "chrome/browser/profiles/profile_info_cache.h"
|
| +#include "chrome/browser/profiles/profile_attributes_entry.h"
|
| +#include "chrome/browser/profiles/profile_attributes_storage.h"
|
| #include "chrome/browser/profiles/profile_manager.h"
|
| #include "chrome/browser/profiles/profile_metrics.h"
|
| #include "chrome/browser/profiles/profiles_state.h"
|
| @@ -120,29 +121,22 @@ void GAIAInfoUpdateService::OnProfileDownloadSuccess(
|
| downloader->GetProfilePictureStatus();
|
| std::string picture_url = downloader->GetProfilePictureURL();
|
|
|
| - ProfileInfoCache& cache =
|
| - g_browser_process->profile_manager()->GetProfileInfoCache();
|
| - size_t profile_index = cache.GetIndexOfProfileWithPath(profile_->GetPath());
|
| - if (profile_index == std::string::npos)
|
| + ProfileAttributesEntry* entry;
|
| + if (!g_browser_process->profile_manager()->GetProfileAttributesStorage().
|
| + GetProfileAttributesWithPath(profile_->GetPath(), &entry)) {
|
| return;
|
| + }
|
|
|
| - cache.SetGAIANameOfProfileAtIndex(profile_index, full_name);
|
| - // The profile index may have changed.
|
| - profile_index = cache.GetIndexOfProfileWithPath(profile_->GetPath());
|
| - DCHECK_NE(profile_index, std::string::npos);
|
| -
|
| - cache.SetGAIAGivenNameOfProfileAtIndex(profile_index, given_name);
|
| - // The profile index may have changed.
|
| - profile_index = cache.GetIndexOfProfileWithPath(profile_->GetPath());
|
| - DCHECK_NE(profile_index, std::string::npos);
|
| + entry->SetGAIAName(full_name);
|
| + entry->SetGAIAGivenName(given_name);
|
|
|
| if (picture_status == ProfileDownloader::PICTURE_SUCCESS) {
|
| profile_->GetPrefs()->SetString(prefs::kProfileGAIAInfoPictureURL,
|
| picture_url);
|
| gfx::Image gfx_image = gfx::Image::CreateFrom1xBitmap(bitmap);
|
| - cache.SetGAIAPictureOfProfileAtIndex(profile_index, &gfx_image);
|
| + entry->SetGAIAPicture(&gfx_image);
|
| } else if (picture_status == ProfileDownloader::PICTURE_DEFAULT) {
|
| - cache.SetGAIAPictureOfProfileAtIndex(profile_index, NULL);
|
| + entry->SetGAIAPicture(nullptr);
|
| }
|
|
|
| const base::string16 hosted_domain = downloader->GetProfileHostedDomain();
|
| @@ -164,21 +158,17 @@ void GAIAInfoUpdateService::OnProfileDownloadFailure(
|
| }
|
|
|
| void GAIAInfoUpdateService::OnUsernameChanged(const std::string& username) {
|
| - ProfileInfoCache& cache =
|
| - g_browser_process->profile_manager()->GetProfileInfoCache();
|
| - size_t profile_index = cache.GetIndexOfProfileWithPath(profile_->GetPath());
|
| - if (profile_index == std::string::npos)
|
| + ProfileAttributesEntry* entry;
|
| + if (!g_browser_process->profile_manager()->GetProfileAttributesStorage().
|
| + GetProfileAttributesWithPath(profile_->GetPath(), &entry)) {
|
| return;
|
| + }
|
|
|
| if (username.empty()) {
|
| // Unset the old user's GAIA info.
|
| - cache.SetGAIANameOfProfileAtIndex(profile_index, base::string16());
|
| - cache.SetGAIAGivenNameOfProfileAtIndex(profile_index, base::string16());
|
| - // The profile index may have changed.
|
| - profile_index = cache.GetIndexOfProfileWithPath(profile_->GetPath());
|
| - if (profile_index == std::string::npos)
|
| - return;
|
| - cache.SetGAIAPictureOfProfileAtIndex(profile_index, NULL);
|
| + entry->SetGAIAName(base::string16());
|
| + entry->SetGAIAGivenName(base::string16());
|
| + entry->SetGAIAPicture(nullptr);
|
| // Unset the cached URL.
|
| profile_->GetPrefs()->ClearPref(prefs::kProfileGAIAInfoPictureURL);
|
| } else {
|
| @@ -197,7 +187,7 @@ void GAIAInfoUpdateService::Shutdown() {
|
| // OK to reset |profile_| pointer here because GAIAInfoUpdateService will not
|
| // access it again. This pointer is also used to implement the delegate for
|
| // |profile_image_downloader_|. However that object was destroyed above.
|
| - profile_ = NULL;
|
| + profile_ = nullptr;
|
| }
|
|
|
| void GAIAInfoUpdateService::ScheduleNextUpdate() {
|
|
|