| 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 #ifndef CHROME_BROWSER_PROFILES_PROFILE_INFO_CACHE_H_ | 5 #ifndef CHROME_BROWSER_PROFILES_PROFILE_INFO_CACHE_H_ |
| 6 #define CHROME_BROWSER_PROFILES_PROFILE_INFO_CACHE_H_ | 6 #define CHROME_BROWSER_PROFILES_PROFILE_INFO_CACHE_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 | 32 |
| 33 // This class saves various information about profiles to local preferences. | 33 // This class saves various information about profiles to local preferences. |
| 34 // This cache can be used to display a list of profiles without having to | 34 // This cache can be used to display a list of profiles without having to |
| 35 // actually load the profiles from disk. | 35 // actually load the profiles from disk. |
| 36 class ProfileInfoCache : public ProfileInfoInterface, | 36 class ProfileInfoCache : public ProfileInfoInterface, |
| 37 public base::SupportsWeakPtr<ProfileInfoCache> { | 37 public base::SupportsWeakPtr<ProfileInfoCache> { |
| 38 public: | 38 public: |
| 39 ProfileInfoCache(PrefService* prefs, const base::FilePath& user_data_dir); | 39 ProfileInfoCache(PrefService* prefs, const base::FilePath& user_data_dir); |
| 40 virtual ~ProfileInfoCache(); | 40 virtual ~ProfileInfoCache(); |
| 41 | 41 |
| 42 // This |is_managed| refers to local management (formerly "managed mode"), | 42 // If the |supervised_user_id| is non-empty, the profile will be marked to be |
| 43 // not enterprise management. If the |managed_user_id| is non-empty, the | 43 // omitted from the avatar-menu list on desktop versions. This is used while a |
| 44 // profile will be marked to be omitted from the avatar-menu list on desktop | 44 // supervised user is in the process of being registered with the server. Use |
| 45 // versions. This is used while a managed user is in the process of being | 45 // SetIsOmittedProfileAtIndex() to clear the flag when the profile is ready to |
| 46 // registered with the server. Use SetIsOmittedProfileAtIndex() to clear the | 46 // be shown in the menu. |
| 47 // flag when the profile is ready to be shown in the menu. | |
| 48 void AddProfileToCache(const base::FilePath& profile_path, | 47 void AddProfileToCache(const base::FilePath& profile_path, |
| 49 const base::string16& name, | 48 const base::string16& name, |
| 50 const base::string16& username, | 49 const base::string16& username, |
| 51 size_t icon_index, | 50 size_t icon_index, |
| 52 const std::string& managed_user_id); | 51 const std::string& supervised_user_id); |
| 53 void DeleteProfileFromCache(const base::FilePath& profile_path); | 52 void DeleteProfileFromCache(const base::FilePath& profile_path); |
| 54 | 53 |
| 55 // ProfileInfoInterface: | 54 // ProfileInfoInterface: |
| 56 virtual size_t GetNumberOfProfiles() const OVERRIDE; | 55 virtual size_t GetNumberOfProfiles() const OVERRIDE; |
| 57 // Don't cache this value and reuse, because resorting the menu could cause | 56 // Don't cache this value and reuse, because resorting the menu could cause |
| 58 // the item being referred to to change out from under you. | 57 // the item being referred to to change out from under you. |
| 59 virtual size_t GetIndexOfProfileWithPath( | 58 virtual size_t GetIndexOfProfileWithPath( |
| 60 const base::FilePath& profile_path) const OVERRIDE; | 59 const base::FilePath& profile_path) const OVERRIDE; |
| 61 virtual base::string16 GetNameOfProfileAtIndex(size_t index) const OVERRIDE; | 60 virtual base::string16 GetNameOfProfileAtIndex(size_t index) const OVERRIDE; |
| 62 virtual base::string16 GetShortcutNameOfProfileAtIndex(size_t index) | 61 virtual base::string16 GetShortcutNameOfProfileAtIndex(size_t index) |
| (...skipping 15 matching lines...) Expand all Loading... |
| 78 size_t index) const OVERRIDE; | 77 size_t index) const OVERRIDE; |
| 79 virtual base::string16 GetGAIAGivenNameOfProfileAtIndex( | 78 virtual base::string16 GetGAIAGivenNameOfProfileAtIndex( |
| 80 size_t index) const OVERRIDE; | 79 size_t index) const OVERRIDE; |
| 81 // Returns the GAIA picture for the given profile. This may return NULL | 80 // Returns the GAIA picture for the given profile. This may return NULL |
| 82 // if the profile does not have a GAIA picture or if the picture must be | 81 // if the profile does not have a GAIA picture or if the picture must be |
| 83 // loaded from disk. | 82 // loaded from disk. |
| 84 virtual const gfx::Image* GetGAIAPictureOfProfileAtIndex( | 83 virtual const gfx::Image* GetGAIAPictureOfProfileAtIndex( |
| 85 size_t index) const OVERRIDE; | 84 size_t index) const OVERRIDE; |
| 86 virtual bool IsUsingGAIAPictureOfProfileAtIndex( | 85 virtual bool IsUsingGAIAPictureOfProfileAtIndex( |
| 87 size_t index) const OVERRIDE; | 86 size_t index) const OVERRIDE; |
| 88 virtual bool ProfileIsManagedAtIndex(size_t index) const OVERRIDE; | 87 virtual bool ProfileIsSupervisedAtIndex(size_t index) const OVERRIDE; |
| 89 virtual bool IsOmittedProfileAtIndex(size_t index) const OVERRIDE; | 88 virtual bool IsOmittedProfileAtIndex(size_t index) const OVERRIDE; |
| 90 virtual bool ProfileIsSigninRequiredAtIndex(size_t index) const OVERRIDE; | 89 virtual bool ProfileIsSigninRequiredAtIndex(size_t index) const OVERRIDE; |
| 91 virtual std::string GetManagedUserIdOfProfileAtIndex(size_t index) const | 90 virtual std::string GetSupervisedUserIdOfProfileAtIndex(size_t index) const |
| 92 OVERRIDE; | 91 OVERRIDE; |
| 93 virtual bool ProfileIsEphemeralAtIndex(size_t index) const OVERRIDE; | 92 virtual bool ProfileIsEphemeralAtIndex(size_t index) const OVERRIDE; |
| 94 virtual bool ProfileIsUsingDefaultNameAtIndex(size_t index) const OVERRIDE; | 93 virtual bool ProfileIsUsingDefaultNameAtIndex(size_t index) const OVERRIDE; |
| 95 | 94 |
| 96 size_t GetAvatarIconIndexOfProfileAtIndex(size_t index) const; | 95 size_t GetAvatarIconIndexOfProfileAtIndex(size_t index) const; |
| 97 | 96 |
| 98 void SetProfileActiveTimeAtIndex(size_t index); | 97 void SetProfileActiveTimeAtIndex(size_t index); |
| 99 void SetNameOfProfileAtIndex(size_t index, const base::string16& name); | 98 void SetNameOfProfileAtIndex(size_t index, const base::string16& name); |
| 100 void SetShortcutNameOfProfileAtIndex(size_t index, | 99 void SetShortcutNameOfProfileAtIndex(size_t index, |
| 101 const base::string16& name); | 100 const base::string16& name); |
| 102 void SetUserNameOfProfileAtIndex(size_t index, | 101 void SetUserNameOfProfileAtIndex(size_t index, |
| 103 const base::string16& user_name); | 102 const base::string16& user_name); |
| 104 void SetAvatarIconOfProfileAtIndex(size_t index, size_t icon_index); | 103 void SetAvatarIconOfProfileAtIndex(size_t index, size_t icon_index); |
| 105 void SetIsOmittedProfileAtIndex(size_t index, bool is_omitted); | 104 void SetIsOmittedProfileAtIndex(size_t index, bool is_omitted); |
| 106 void SetManagedUserIdOfProfileAtIndex(size_t index, const std::string& id); | 105 void SetSupervisedUserIdOfProfileAtIndex(size_t index, const std::string& id); |
| 107 void SetLocalAuthCredentialsOfProfileAtIndex(size_t index, | 106 void SetLocalAuthCredentialsOfProfileAtIndex(size_t index, |
| 108 const std::string& auth); | 107 const std::string& auth); |
| 109 void SetBackgroundStatusOfProfileAtIndex(size_t index, | 108 void SetBackgroundStatusOfProfileAtIndex(size_t index, |
| 110 bool running_background_apps); | 109 bool running_background_apps); |
| 111 void SetGAIANameOfProfileAtIndex(size_t index, const base::string16& name); | 110 void SetGAIANameOfProfileAtIndex(size_t index, const base::string16& name); |
| 112 void SetGAIAGivenNameOfProfileAtIndex(size_t index, | 111 void SetGAIAGivenNameOfProfileAtIndex(size_t index, |
| 113 const base::string16& name); | 112 const base::string16& name); |
| 114 void SetGAIAPictureOfProfileAtIndex(size_t index, const gfx::Image* image); | 113 void SetGAIAPictureOfProfileAtIndex(size_t index, const gfx::Image* image); |
| 115 void SetIsUsingGAIAPictureOfProfileAtIndex(size_t index, bool value); | 114 void SetIsUsingGAIAPictureOfProfileAtIndex(size_t index, bool value); |
| 116 void SetProfileSigninRequiredAtIndex(size_t index, bool value); | 115 void SetProfileSigninRequiredAtIndex(size_t index, bool value); |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 // This prevents a picture from being downloaded multiple times. The | 216 // This prevents a picture from being downloaded multiple times. The |
| 218 // ProfileAvatarDownloader instances are deleted when the download completes | 217 // ProfileAvatarDownloader instances are deleted when the download completes |
| 219 // or when the ProfileInfoCache is destroyed. | 218 // or when the ProfileInfoCache is destroyed. |
| 220 mutable std::map<std::string, ProfileAvatarDownloader*> | 219 mutable std::map<std::string, ProfileAvatarDownloader*> |
| 221 avatar_images_downloads_in_progress_; | 220 avatar_images_downloads_in_progress_; |
| 222 | 221 |
| 223 DISALLOW_COPY_AND_ASSIGN(ProfileInfoCache); | 222 DISALLOW_COPY_AND_ASSIGN(ProfileInfoCache); |
| 224 }; | 223 }; |
| 225 | 224 |
| 226 #endif // CHROME_BROWSER_PROFILES_PROFILE_INFO_CACHE_H_ | 225 #endif // CHROME_BROWSER_PROFILES_PROFILE_INFO_CACHE_H_ |
| OLD | NEW |