blob: be37714d5d67b632f9eec90c5e5bc11a625f3f52 [file] [log] [blame]
anthonyvdb50a7cb2015-07-13 15:42:031// 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
avib896c712015-12-26 02:10:438#include <stddef.h>
9
lwchkg99addc852016-02-10 16:14:5510#include <string>
11#include <vector>
avib896c712015-12-26 02:10:4312
lwchkg99addc852016-02-10 16:14:5513#include "base/macros.h"
14#include "base/strings/string16.h"
15#include "chrome/browser/profiles/profile_info_cache_observer.h"
16
17namespace base {
18class FilePath;
19} // namespace base
anthonyvdb50a7cb2015-07-13 15:42:0320class ProfileAttributesEntry;
21
22class ProfileAttributesStorage {
23 public:
lwchkg99addc852016-02-10 16:14:5524 using Observer = ProfileInfoCacheObserver;
25
anthonyvdb50a7cb2015-07-13 15:42:0326 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
lwchkg99addc852016-02-10 16:14:5559 virtual void AddObserver(ProfileAttributesStorage::Observer* observer) = 0;
60 virtual void RemoveObserver(ProfileAttributesStorage::Observer* observer) = 0;
61
62 private:
anthonyvdb50a7cb2015-07-13 15:42:0363 DISALLOW_COPY_AND_ASSIGN(ProfileAttributesStorage);
64};
65
66#endif // CHROME_BROWSER_PROFILES_PROFILE_ATTRIBUTES_STORAGE_H_