anthonyvd | b50a7cb | 2015-07-13 15:42:03 | [diff] [blame] | 1 | // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #ifndef CHROME_BROWSER_PROFILES_PROFILE_ATTRIBUTES_STORAGE_H_ |
| 6 | #define CHROME_BROWSER_PROFILES_PROFILE_ATTRIBUTES_STORAGE_H_ |
| 7 | |
avi | b896c71 | 2015-12-26 02:10:43 | [diff] [blame] | 8 | #include <stddef.h> |
| 9 | |
lwchkg | 99addc85 | 2016-02-10 16:14:55 | [diff] [blame^] | 10 | #include <string> |
| 11 | #include <vector> |
avi | b896c71 | 2015-12-26 02:10:43 | [diff] [blame] | 12 | |
lwchkg | 99addc85 | 2016-02-10 16:14:55 | [diff] [blame^] | 13 | #include "base/macros.h" |
| 14 | #include "base/strings/string16.h" |
| 15 | #include "chrome/browser/profiles/profile_info_cache_observer.h" |
| 16 | |
| 17 | namespace base { |
| 18 | class FilePath; |
| 19 | } // namespace base |
anthonyvd | b50a7cb | 2015-07-13 15:42:03 | [diff] [blame] | 20 | class ProfileAttributesEntry; |
| 21 | |
| 22 | class ProfileAttributesStorage { |
| 23 | public: |
lwchkg | 99addc85 | 2016-02-10 16:14:55 | [diff] [blame^] | 24 | using Observer = ProfileInfoCacheObserver; |
| 25 | |
anthonyvd | b50a7cb | 2015-07-13 15:42:03 | [diff] [blame] | 26 | ProfileAttributesStorage() {} |
| 27 | ~ProfileAttributesStorage() {} |
| 28 | |
| 29 | // If the |supervised_user_id| is non-empty, the profile will be marked to be |
| 30 | // omitted from the avatar-menu list on desktop versions. This is used while a |
| 31 | // supervised user is in the process of being registered with the server. Use |
| 32 | // ProfileAttributesEntry::SetIsOmitted() to clear the flag when the profile |
| 33 | // is ready to be shown in the menu. |
| 34 | virtual void AddProfile(const base::FilePath& profile_path, |
| 35 | const base::string16& name, |
| 36 | const std::string& gaia_id, |
| 37 | const base::string16& user_name, |
| 38 | size_t icon_index, |
| 39 | const std::string& supervised_user_id) = 0; |
| 40 | // Removes the profile at |profile_path| from this storage. Does not delete or |
| 41 | // affect the actual profile's data. |
| 42 | virtual void RemoveProfile(const base::FilePath& profile_path) = 0; |
| 43 | |
| 44 | // Returns a vector containing one attributes entry per known profile. They |
| 45 | // are not sorted in any particular order. |
| 46 | virtual std::vector<ProfileAttributesEntry*> GetAllProfilesAttributes() = 0; |
| 47 | |
| 48 | // Populates |entry| with the data for the profile at |path| and returns true |
| 49 | // if the operation is successful and |entry| can be used. Returns false |
| 50 | // otherwise. |
| 51 | // |entry| should not be cached as it may not reflect subsequent changes to |
| 52 | // the profile's metadata. |
| 53 | virtual bool GetProfileAttributesWithPath( |
| 54 | const base::FilePath& path, ProfileAttributesEntry** entry) = 0; |
| 55 | |
| 56 | // Returns the count of known profiles. |
| 57 | virtual size_t GetNumberOfProfiles() const = 0; |
| 58 | |
lwchkg | 99addc85 | 2016-02-10 16:14:55 | [diff] [blame^] | 59 | virtual void AddObserver(ProfileAttributesStorage::Observer* observer) = 0; |
| 60 | virtual void RemoveObserver(ProfileAttributesStorage::Observer* observer) = 0; |
| 61 | |
| 62 | private: |
anthonyvd | b50a7cb | 2015-07-13 15:42:03 | [diff] [blame] | 63 | DISALLOW_COPY_AND_ASSIGN(ProfileAttributesStorage); |
| 64 | }; |
| 65 | |
| 66 | #endif // CHROME_BROWSER_PROFILES_PROFILE_ATTRIBUTES_STORAGE_H_ |