| 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 28 matching lines...) Expand all Loading... |
| 39 ProfileInfoCache(PrefService* prefs, const base::FilePath& user_data_dir); | 39 ProfileInfoCache(PrefService* prefs, const base::FilePath& user_data_dir); |
| 40 ~ProfileInfoCache() override; | 40 ~ProfileInfoCache() override; |
| 41 | 41 |
| 42 // If the |supervised_user_id| is non-empty, the profile will be marked to be | 42 // If the |supervised_user_id| is non-empty, the profile will be marked to be |
| 43 // omitted from the avatar-menu list on desktop versions. This is used while a | 43 // omitted from the avatar-menu list on desktop versions. This is used while a |
| 44 // supervised user is in the process of being registered with the server. Use | 44 // supervised user is in the process of being registered with the server. Use |
| 45 // SetIsOmittedProfileAtIndex() to clear the flag when the profile is ready to | 45 // SetIsOmittedProfileAtIndex() to clear the flag when the profile is ready to |
| 46 // be shown in the menu. | 46 // be shown in the menu. |
| 47 void AddProfileToCache(const base::FilePath& profile_path, | 47 void AddProfileToCache(const base::FilePath& profile_path, |
| 48 const base::string16& name, | 48 const base::string16& name, |
| 49 const base::string16& username, | 49 const std::string& gaia_id, |
| 50 const base::string16& user_name, |
| 50 size_t icon_index, | 51 size_t icon_index, |
| 51 const std::string& supervised_user_id); | 52 const std::string& supervised_user_id); |
| 52 void DeleteProfileFromCache(const base::FilePath& profile_path); | 53 void DeleteProfileFromCache(const base::FilePath& profile_path); |
| 53 | 54 |
| 54 // ProfileInfoInterface: | 55 // ProfileInfoInterface: |
| 55 size_t GetNumberOfProfiles() const override; | 56 size_t GetNumberOfProfiles() const override; |
| 56 // Don't cache this value and reuse, because resorting the menu could cause | 57 // Don't cache this value and reuse, because resorting the menu could cause |
| 57 // the item being referred to to change out from under you. | 58 // the item being referred to to change out from under you. |
| 58 size_t GetIndexOfProfileWithPath( | 59 size_t GetIndexOfProfileWithPath( |
| 59 const base::FilePath& profile_path) const override; | 60 const base::FilePath& profile_path) const override; |
| 60 base::string16 GetNameOfProfileAtIndex(size_t index) const override; | 61 base::string16 GetNameOfProfileAtIndex(size_t index) const override; |
| 61 base::string16 GetShortcutNameOfProfileAtIndex(size_t index) const override; | 62 base::string16 GetShortcutNameOfProfileAtIndex(size_t index) const override; |
| 62 base::FilePath GetPathOfProfileAtIndex(size_t index) const override; | 63 base::FilePath GetPathOfProfileAtIndex(size_t index) const override; |
| 63 base::Time GetProfileActiveTimeAtIndex(size_t index) const override; | 64 base::Time GetProfileActiveTimeAtIndex(size_t index) const override; |
| 64 base::string16 GetUserNameOfProfileAtIndex(size_t index) const override; | 65 base::string16 GetUserNameOfProfileAtIndex(size_t index) const override; |
| 65 const gfx::Image& GetAvatarIconOfProfileAtIndex(size_t index) override; | 66 const gfx::Image& GetAvatarIconOfProfileAtIndex(size_t index) override; |
| 66 std::string GetLocalAuthCredentialsOfProfileAtIndex( | 67 std::string GetLocalAuthCredentialsOfProfileAtIndex( |
| 67 size_t index) const override; | 68 size_t index) const override; |
| 68 // Note that a return value of false could mean an error in collection or | 69 // Note that a return value of false could mean an error in collection or |
| 69 // that there are currently no background apps running. However, the action | 70 // that there are currently no background apps running. However, the action |
| 70 // which results is the same in both cases (thus far). | 71 // which results is the same in both cases (thus far). |
| 71 bool GetBackgroundStatusOfProfileAtIndex(size_t index) const override; | 72 bool GetBackgroundStatusOfProfileAtIndex(size_t index) const override; |
| 72 base::string16 GetGAIANameOfProfileAtIndex(size_t index) const override; | 73 base::string16 GetGAIANameOfProfileAtIndex(size_t index) const override; |
| 73 base::string16 GetGAIAGivenNameOfProfileAtIndex(size_t index) const override; | 74 base::string16 GetGAIAGivenNameOfProfileAtIndex(size_t index) const override; |
| 75 std::string GetGAIAIdOfProfileAtIndex(size_t index) const override; |
| 74 // Returns the GAIA picture for the given profile. This may return NULL | 76 // Returns the GAIA picture for the given profile. This may return NULL |
| 75 // if the profile does not have a GAIA picture or if the picture must be | 77 // if the profile does not have a GAIA picture or if the picture must be |
| 76 // loaded from disk. | 78 // loaded from disk. |
| 77 const gfx::Image* GetGAIAPictureOfProfileAtIndex(size_t index) const override; | 79 const gfx::Image* GetGAIAPictureOfProfileAtIndex(size_t index) const override; |
| 78 bool IsUsingGAIAPictureOfProfileAtIndex(size_t index) const override; | 80 bool IsUsingGAIAPictureOfProfileAtIndex(size_t index) const override; |
| 79 bool ProfileIsSupervisedAtIndex(size_t index) const override; | 81 bool ProfileIsSupervisedAtIndex(size_t index) const override; |
| 80 bool ProfileIsChildAtIndex(size_t index) const override; | 82 bool ProfileIsChildAtIndex(size_t index) const override; |
| 81 bool ProfileIsLegacySupervisedAtIndex(size_t index) const override; | 83 bool ProfileIsLegacySupervisedAtIndex(size_t index) const override; |
| 82 bool IsOmittedProfileAtIndex(size_t index) const override; | 84 bool IsOmittedProfileAtIndex(size_t index) const override; |
| 83 bool ProfileIsSigninRequiredAtIndex(size_t index) const override; | 85 bool ProfileIsSigninRequiredAtIndex(size_t index) const override; |
| 84 std::string GetSupervisedUserIdOfProfileAtIndex(size_t index) const override; | 86 std::string GetSupervisedUserIdOfProfileAtIndex(size_t index) const override; |
| 85 bool ProfileIsEphemeralAtIndex(size_t index) const override; | 87 bool ProfileIsEphemeralAtIndex(size_t index) const override; |
| 86 bool ProfileIsUsingDefaultNameAtIndex(size_t index) const override; | 88 bool ProfileIsUsingDefaultNameAtIndex(size_t index) const override; |
| 89 bool ProfileIsAuthenticatedAtIndex(size_t index) const override; |
| 87 bool ProfileIsUsingDefaultAvatarAtIndex(size_t index) const override; | 90 bool ProfileIsUsingDefaultAvatarAtIndex(size_t index) const override; |
| 88 bool ProfileIsAuthErrorAtIndex(size_t index) const; | 91 bool ProfileIsAuthErrorAtIndex(size_t index) const; |
| 89 | 92 |
| 90 size_t GetAvatarIconIndexOfProfileAtIndex(size_t index) const; | 93 size_t GetAvatarIconIndexOfProfileAtIndex(size_t index) const; |
| 91 | 94 |
| 92 void SetProfileActiveTimeAtIndex(size_t index); | 95 void SetProfileActiveTimeAtIndex(size_t index); |
| 93 // Warning: This will re-sort profiles and thus may change indices! | 96 // Warning: This will re-sort profiles and thus may change indices! |
| 94 void SetNameOfProfileAtIndex(size_t index, const base::string16& name); | 97 void SetNameOfProfileAtIndex(size_t index, const base::string16& name); |
| 95 void SetShortcutNameOfProfileAtIndex(size_t index, | 98 void SetShortcutNameOfProfileAtIndex(size_t index, |
| 96 const base::string16& name); | 99 const base::string16& name); |
| 97 void SetUserNameOfProfileAtIndex(size_t index, | 100 void SetAuthInfoOfProfileAtIndex(size_t index, |
| 101 const std::string& gaia_id, |
| 98 const base::string16& user_name); | 102 const base::string16& user_name); |
| 99 void SetAvatarIconOfProfileAtIndex(size_t index, size_t icon_index); | 103 void SetAvatarIconOfProfileAtIndex(size_t index, size_t icon_index); |
| 100 void SetIsOmittedProfileAtIndex(size_t index, bool is_omitted); | 104 void SetIsOmittedProfileAtIndex(size_t index, bool is_omitted); |
| 101 void SetSupervisedUserIdOfProfileAtIndex(size_t index, const std::string& id); | 105 void SetSupervisedUserIdOfProfileAtIndex(size_t index, const std::string& id); |
| 102 void SetLocalAuthCredentialsOfProfileAtIndex(size_t index, | 106 void SetLocalAuthCredentialsOfProfileAtIndex(size_t index, |
| 103 const std::string& auth); | 107 const std::string& auth); |
| 104 void SetBackgroundStatusOfProfileAtIndex(size_t index, | 108 void SetBackgroundStatusOfProfileAtIndex(size_t index, |
| 105 bool running_background_apps); | 109 bool running_background_apps); |
| 106 // Warning: This will re-sort profiles and thus may change indices! | 110 // Warning: This will re-sort profiles and thus may change indices! |
| 107 void SetGAIANameOfProfileAtIndex(size_t index, const base::string16& name); | 111 void SetGAIANameOfProfileAtIndex(size_t index, const base::string16& name); |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 230 avatar_images_downloads_in_progress_; | 234 avatar_images_downloads_in_progress_; |
| 231 | 235 |
| 232 // Determines of the ProfileAvatarDownloader should be created and executed | 236 // Determines of the ProfileAvatarDownloader should be created and executed |
| 233 // or not. Only set to true for tests. | 237 // or not. Only set to true for tests. |
| 234 bool disable_avatar_download_for_testing_; | 238 bool disable_avatar_download_for_testing_; |
| 235 | 239 |
| 236 DISALLOW_COPY_AND_ASSIGN(ProfileInfoCache); | 240 DISALLOW_COPY_AND_ASSIGN(ProfileInfoCache); |
| 237 }; | 241 }; |
| 238 | 242 |
| 239 #endif // CHROME_BROWSER_PROFILES_PROFILE_INFO_CACHE_H_ | 243 #endif // CHROME_BROWSER_PROFILES_PROFILE_INFO_CACHE_H_ |
| OLD | NEW |