Commit b0edddda authored by sail@chromium.org's avatar sail@chromium.org

Revert 111254 - Add GAIA info to profile info cache

BUG=91241
TEST=


Review URL: http://codereview.chromium.org/8587023

TBR=sail@chromium.org
Review URL: http://codereview.chromium.org/8673003

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@111261 0039d316-1c4b-4281-b951-d872f2087c98
parent 17044d66
...@@ -212,7 +212,7 @@ class UserManager : public ProfileDownloaderDelegate, ...@@ -212,7 +212,7 @@ class UserManager : public ProfileDownloaderDelegate,
void CheckOwnership(); void CheckOwnership();
// ProfileDownloaderDelegate implementation. // ProfileDownloaderDelegate implementation.
virtual int GetDesiredImageSize() OVERRIDE; virtual int GetDesiredImageSideLength() OVERRIDE;
virtual Profile* GetBrowserProfile() OVERRIDE; virtual Profile* GetBrowserProfile() OVERRIDE;
virtual void OnDownloadComplete(ProfileDownloader* downloader, virtual void OnDownloadComplete(ProfileDownloader* downloader,
bool success) OVERRIDE; bool success) OVERRIDE;
......
...@@ -6,14 +6,12 @@ ...@@ -6,14 +6,12 @@
#define CHROME_BROWSER_PROFILES_PROFILE_INFO_CACHE_H_ #define CHROME_BROWSER_PROFILES_PROFILE_INFO_CACHE_H_
#pragma once #pragma once
#include <map>
#include <string> #include <string>
#include <vector> #include <vector>
#include "base/basictypes.h" #include "base/basictypes.h"
#include "base/compiler_specific.h" #include "base/compiler_specific.h"
#include "base/file_path.h" #include "base/file_path.h"
#include "base/memory/weak_ptr.h"
#include "base/observer_list.h" #include "base/observer_list.h"
#include "base/string16.h" #include "base/string16.h"
#include "chrome/browser/profiles/profile_info_cache_observer.h" #include "chrome/browser/profiles/profile_info_cache_observer.h"
...@@ -32,8 +30,7 @@ class PrefService; ...@@ -32,8 +30,7 @@ class PrefService;
// This class saves various information about profiles to local preferences. // This class saves various information about profiles to local preferences.
// This cache can be used to display a list of profiles without having to // This cache can be used to display a list of profiles without having to
// actually load the profiles from disk. // actually load the profiles from disk.
class ProfileInfoCache : public ProfileInfoInterface, class ProfileInfoCache : public ProfileInfoInterface {
public base::SupportsWeakPtr<ProfileInfoCache> {
public: public:
ProfileInfoCache(PrefService* prefs, const FilePath& user_data_dir); ProfileInfoCache(PrefService* prefs, const FilePath& user_data_dir);
virtual ~ProfileInfoCache(); virtual ~ProfileInfoCache();
...@@ -57,12 +54,6 @@ class ProfileInfoCache : public ProfileInfoInterface, ...@@ -57,12 +54,6 @@ class ProfileInfoCache : public ProfileInfoInterface,
size_t index) const OVERRIDE; size_t index) const OVERRIDE;
virtual bool GetBackgroundStatusOfProfileAtIndex( virtual bool GetBackgroundStatusOfProfileAtIndex(
size_t index) const OVERRIDE; size_t index) const OVERRIDE;
virtual string16 GetGAIANameOfProfileAtIndex(size_t index) const OVERRIDE;
virtual bool IsUsingGAIANameOfProfileAtIndex(size_t index) const OVERRIDE;
virtual const gfx::Image& GetGAIAPictureOfProfileAtIndex(
size_t index) const OVERRIDE;
virtual bool IsUsingGAIAPictureOfProfileAtIndex(
size_t index) const OVERRIDE;
size_t GetAvatarIconIndexOfProfileAtIndex(size_t index) const; size_t GetAvatarIconIndexOfProfileAtIndex(size_t index) const;
...@@ -71,24 +62,10 @@ class ProfileInfoCache : public ProfileInfoInterface, ...@@ -71,24 +62,10 @@ class ProfileInfoCache : public ProfileInfoInterface,
void SetAvatarIconOfProfileAtIndex(size_t index, size_t icon_index); void SetAvatarIconOfProfileAtIndex(size_t index, size_t icon_index);
void SetBackgroundStatusOfProfileAtIndex(size_t index, void SetBackgroundStatusOfProfileAtIndex(size_t index,
bool running_background_apps); bool running_background_apps);
void SetGAIANameOfProfileAtIndex(size_t index, const string16& name);
void SetIsUsingGAIANameOfProfileAtIndex(size_t index, bool value);
void SetGAIAPictureOfProfileAtIndex(size_t index, const gfx::Image& image);
void SetIsUsingGAIAPictureOfProfileAtIndex(size_t index, bool value);
// Returns unique name that can be assigned to a newly created profile. // Returns unique name that can be assigned to a newly created profile.
string16 ChooseNameForNewProfile(size_t icon_index); string16 ChooseNameForNewProfile(size_t icon_index);
// Checks if the given profile has switched to using GAIA information
// for the profile name and picture. This pref is used to switch over
// to GAIA info the first time it is available. Afterwards this pref is
// checked to prevent clobbering the user's custom settings.
bool GetHasMigratedToGAIAInfoOfProfileAtIndex(size_t index) const;
// Marks the given profile as having switched to using GAIA information
// for the profile name and picture.
void SetHasMigratedToGAIAInfoOfProfileAtIndex(size_t index, bool value);
// Returns an avatar icon index that can be assigned to a newly created // Returns an avatar icon index that can be assigned to a newly created
// profile. Note that the icon may not be unique since there are a limited // profile. Note that the icon may not be unique since there are a limited
// set of default icons. // set of default icons.
...@@ -139,23 +116,12 @@ class ProfileInfoCache : public ProfileInfoInterface, ...@@ -139,23 +116,12 @@ class ProfileInfoCache : public ProfileInfoInterface,
bool must_be_unique, bool must_be_unique,
size_t* out_icon_index) const; size_t* out_icon_index) const;
// Updates the position of the profile at the given index so that the list
// of profiles is still sorted.
void UpdateSortForProfileIndex(size_t index);
void OnGAIAPictureLoaded(FilePath path, gfx::Image** image) const;
void OnGAIAPictureSaved(FilePath path, bool* success) const;
PrefService* prefs_; PrefService* prefs_;
std::vector<std::string> sorted_keys_; std::vector<std::string> sorted_keys_;
FilePath user_data_dir_; FilePath user_data_dir_;
ObserverList<ProfileInfoCacheObserver> observer_list_; ObserverList<ProfileInfoCacheObserver> observer_list_;
// A cache of gaia profile pictures. This cache is updated lazily so it needs
// to be mutable.
mutable std::map<std::string, gfx::Image*> gaia_pictures_;
DISALLOW_COPY_AND_ASSIGN(ProfileInfoCache); DISALLOW_COPY_AND_ASSIGN(ProfileInfoCache);
}; };
......
...@@ -36,17 +36,6 @@ class ProfileInfoInterface { ...@@ -36,17 +36,6 @@ class ProfileInfoInterface {
virtual bool GetBackgroundStatusOfProfileAtIndex( virtual bool GetBackgroundStatusOfProfileAtIndex(
size_t index) const = 0; size_t index) const = 0;
virtual string16 GetGAIANameOfProfileAtIndex(size_t index) const = 0;
// Checks if the GAIA name should be used as the profile's name.
virtual bool IsUsingGAIANameOfProfileAtIndex(size_t index) const = 0;
virtual const gfx::Image& GetGAIAPictureOfProfileAtIndex(
size_t index) const = 0;
// Checks if the GAIA picture should be used as the profile's avatar icon.
virtual bool IsUsingGAIAPictureOfProfileAtIndex(size_t index) const = 0;
protected: protected:
virtual ~ProfileInfoInterface() {} virtual ~ProfileInfoInterface() {}
}; };
......
...@@ -929,10 +929,6 @@ enum NotificationType { ...@@ -929,10 +929,6 @@ enum NotificationType {
// Sent when the cached profile info has changed. // Sent when the cached profile info has changed.
NOTIFICATION_PROFILE_CACHED_INFO_CHANGED, NOTIFICATION_PROFILE_CACHED_INFO_CHANGED,
// Sent when the cached profile has finished writing a profile picture to
// disk.
NOTIFICATION_PROFILE_CACHE_PICTURE_SAVED,
// Sent when the browser enters or exits fullscreen mode. // Sent when the browser enters or exits fullscreen mode.
NOTIFICATION_FULLSCREEN_CHANGED, NOTIFICATION_FULLSCREEN_CHANGED,
......
...@@ -97,10 +97,6 @@ ProfileInfoCache* TestingProfileManager::profile_info_cache() { ...@@ -97,10 +97,6 @@ ProfileInfoCache* TestingProfileManager::profile_info_cache() {
return &profile_manager_->GetProfileInfoCache(); return &profile_manager_->GetProfileInfoCache();
} }
void TestingProfileManager::DeleteProfileInfoCache() {
profile_manager_->profile_info_cache_.reset(NULL);
}
void TestingProfileManager::SetUpInternal() { void TestingProfileManager::SetUpInternal() {
ASSERT_FALSE(browser_process_->profile_manager()) ASSERT_FALSE(browser_process_->profile_manager())
<< "ProfileManager already exists"; << "ProfileManager already exists";
......
...@@ -52,10 +52,6 @@ class TestingProfileManager { ...@@ -52,10 +52,6 @@ class TestingProfileManager {
// Deletes a TestingProfile from the profile subsystem. // Deletes a TestingProfile from the profile subsystem.
void DeleteTestingProfile(const std::string& profile_name); void DeleteTestingProfile(const std::string& profile_name);
// Deletes the cache instance. This is useful for testing that the cache is
// properly persisting data.
void DeleteProfileInfoCache();
// Helper accessors. // Helper accessors.
ProfileManager* profile_manager(); ProfileManager* profile_manager();
ProfileInfoCache* profile_info_cache(); ProfileInfoCache* profile_info_cache();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment