Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(130)

Side by Side Diff: chrome/browser/profiles/profile_metadata_storage.h

Issue 1214483002: Improve the ProfileInfoCache API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright (c) 2015 The Chromium Authors. All rights reserved.
noms (inactive) 2015/06/29 17:10:40 The 2014-and-after style says there's no (c) neede
anthonyvd 2015/06/30 21:24:52 Done.
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_METADATA_STORAGE_H_
6 #define CHROME_BROWSER_PROFILES_PROFILE_METADATA_STORAGE_H_
7
8 class ProfileInfoCache;
9
10 class ProfileMetadataStorage {
11 public:
12 // Represents one profile's metadata.
13 class ProfileMetadataEntry {
noms (inactive) 2015/06/29 17:10:40 I don't love `metadata` (to me, metadata is like t
Mike Lerman 2015/06/29 19:14:37 I was okay with ProfileMetadata, though I'm also o
anthonyvd 2015/06/30 21:24:53 Done and done. I preferred moving away from Profi
14 public:
15 base::string16 GetName() const;
noms (inactive) 2015/06/29 17:10:40 I'm so confused. This just has getters, but doesn'
anthonyvd 2015/06/30 21:24:53 I completely agree that it's kind of weird. The id
16 base::string16 GetShortcutName() const;
17 base::FilePath GetPath() const;
18 base::Time GetActiveTime() const;
19 base::string16 GetUserName() const;
20 const gfx::Image& GetAvatarIcon();
21 std::string GetLocalAuthCredentials() const;
22 std::string GetPasswordChangeDetectionToken() const;
23 // Note that a return value of false could mean an error in collection or
24 // that there are currently no background apps running. However, the action
25 // which results is the same in both cases (thus far).
26 bool GetBackgroundStatus() const;
27 base::string16 GetGAIAName() const;
28 base::string16 GetGAIAGivenName() const;
29 std::string GetGAIAId() const;
30 // Returns the GAIA picture for the given profile. This may return NULL
31 // if the profile does not have a GAIA picture or if the picture must be
32 // loaded from disk.
33 const gfx::Image* GetGAIAPicture() const;
34 bool IsUsingGAIAPicture() const;
35 bool IsSupervised() const;
36 bool IsChild() const;
37 bool IsLegacySupervised() const;
38 bool IsOmitted() const;
39 bool IsSigninRequired() const;
40 std::string GetSupervisedUserId() const;
41 bool IsEphemeral() const;
42 bool IsUsingDefaultName() const;
43 bool IsAuthenticated() const;
44 bool IsUsingDefaultAvatar() const;
45 bool IsAuthError() const;
46 size_t GetAvatarIconIndex() const;
47
48 void SetName(const base::string16& name);
49 void SetShortcutName(const base::string16& name);
50 void SetIsOmitted(bool is_omitted);
51 void SetSupervisedUserId(const std::string& id);
52 void SetLocalAuthCredentials(const std::string& auth);
53 void SetPasswordChangeDetectionToken(const std::string& token);
54 void SetBackgroundStatus(bool running_background_apps);
55 void SetGAIAName(const base::string16& name);
56 void SetGAIAGivenName(const base::string16& name);
57 void SetGAIAPicture(const gfx::Image* image);
58 void SetIsUsingGAIAPicture(bool value);
59 void SetIsSigninRequired(bool value);
60 void SetIsEphemeral(bool value);
61 void SetIsUsingDefaultName(bool value);
62 void SetIsUsingDefaultAvatar(bool value);
63 void SetIsAuthError(bool value);
64 void SetAvatarIconIndex(size_t icon_index);
65
66 void SetAuthInfo(const std::string& gaia_id,
67 const base::string16& user_name);
68
69 private:
70 // These members are an implementation detail meant to smooth the migration
noms (inactive) 2015/06/29 17:10:40 Probably safe to add a TODO here :)
anthonyvd 2015/06/30 21:24:53 Done.
71 // of the ProfileInfoCache to the ProfileMetadataStorage interface. They can
72 // be safely removed once the ProfileInfoCache stops using indices
73 // internally.
74 friend class ProfileInfoCache;
75 size_t profile_index_;
76 ProfileInfoCache* profile_info_cache_;
Mike Lerman 2015/06/29 19:14:37 I imagine you will one day have member variables f
anthonyvd 2015/06/30 21:24:53 Do you think the own above w.r.t. Monica's comment
77 };
78
79 ProfileMetadataStorage() {}
80 ~ProfileMetadataStorage() {}
81
82 // If the |supervised_user_id| is non-empty, the profile will be marked to be
83 // omitted from the avatar-menu list on desktop versions. This is used while a
84 // supervised user is in the process of being registered with the server. Use
85 // SetIsOmittedProfileAtIndex() to clear the flag when the profile is ready to
anthonyvd 2015/06/25 21:38:37 Oops, need to update that comment.
anthonyvd 2015/06/30 21:24:53 Done.
86 // be shown in the menu.
87 virtual void AddProfile(const base::FilePath& profile_path,
88 const base::string16& name,
89 const std::string& gaia_id,
90 const base::string16& user_name,
91 size_t icon_index,
92 const std::string& supervised_user_id) = 0;
93 virtual void DeleteProfile(const base::FilePath& profile_path) = 0;
94
95 // Returns a vector containing one metadata entry per known profile. They are
96 // not sorted in any particular order.
97 virtual std::vector<ProfileMetadataEntry> GetAllProfilesMetadata() = 0;
98
99 // Populates |entry| with the data for the profile at |path| and returns true
100 // if the operation is successful and |entry| can be used. Returns false
101 // otherwise.
102 // |entry| should not be cached as it will not reflect subsequent changes to
103 // the profile's metadata.
104 virtual bool GetProfileMetadataWithPath(
105 const base::FilePath& path, ProfileMetadataEntry* entry) = 0;
Mike Lerman 2015/06/29 19:14:37 Perhaps make the second parameter a *& rather than
anthonyvd 2015/06/30 21:24:53 I'm not too sure about that. The pointer-to-pointe
Mike Lerman 2015/07/02 18:01:30 I agree with your analysis of the two options, and
anthonyvd 2015/07/07 21:05:32 I went ahead and implemented 2) without the actual
106
107 // Returns the amount of known profiles.
Mike Lerman 2015/06/29 19:14:37 s/amount/count? quantity? numeracy?/
anthonyvd 2015/06/30 21:24:53 Done.
108 virtual size_t GetNumberOfProfiles() const = 0;
109
110 DISALLOW_COPY_AND_ASSIGN(ProfileMetadataStorage);
111 };
112
113 #endif // CHROME_BROWSER_PROFILES_PROFILE_METADATA_STORAGE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698