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

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

Issue 1214483002: Improve the ProfileInfoCache API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address feedback and slightly change the interface. Created 5 years, 5 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 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_ENTRY_H_
6 #define CHROME_BROWSER_PROFILES_PROFILE_ATTRIBUTES_ENTRY_H_
7
8 #include <string>
9
10 #include "base/files/file_path.h"
11 #include "base/strings/string16.h"
12 #include "base/time/time.h"
13
14 namespace gfx {
15 class Image;
16 }
17
18 class ProfileInfoCache;
19
20 class ProfileAttributesEntry {
21 public:
22 ProfileAttributesEntry();
23 virtual ~ProfileAttributesEntry() {}
24
25 base::string16 GetName() const;
Mike Lerman 2015/07/08 18:26:35 It would be ideal to actually have comments for al
anthonyvd 2015/07/09 17:02:13 I'll do it in this CL. The latest patchset has som
26 base::string16 GetShortcutName() const;
27 base::FilePath GetPath() const;
28 base::Time GetActiveTime() const;
29 base::string16 GetUserName() const;
30 const gfx::Image& GetAvatarIcon();
31 std::string GetLocalAuthCredentials() const;
32 std::string GetPasswordChangeDetectionToken() const;
33 // Note that a return value of false could mean an error in collection or
34 // that there are currently no background apps running. However, the action
35 // which results is the same in both cases (thus far).
36 bool GetBackgroundStatus() const;
37 base::string16 GetGAIAName() const;
38 base::string16 GetGAIAGivenName() const;
39 std::string GetGAIAId() const;
40 // Returns the GAIA picture for the given profile. This may return NULL
41 // if the profile does not have a GAIA picture or if the picture must be
42 // loaded from disk.
43 const gfx::Image* GetGAIAPicture() const;
44 bool IsUsingGAIAPicture() const;
45 bool IsSupervised() const;
46 bool IsChild() const;
47 bool IsLegacySupervised() const;
48 bool IsOmitted() const;
49 bool IsSigninRequired() const;
50 std::string GetSupervisedUserId() const;
51 bool IsEphemeral() const;
52 bool IsUsingDefaultName() const;
53 bool IsAuthenticated() const;
54 bool IsUsingDefaultAvatar() const;
55 bool IsAuthError() const;
56 size_t GetAvatarIconIndex() const;
57
58 void SetName(const base::string16& name);
59 void SetShortcutName(const base::string16& name);
60 void SetIsOmitted(bool is_omitted);
61 void SetSupervisedUserId(const std::string& id);
62 void SetLocalAuthCredentials(const std::string& auth);
63 void SetPasswordChangeDetectionToken(const std::string& token);
64 void SetBackgroundStatus(bool running_background_apps);
65 void SetGAIAName(const base::string16& name);
66 void SetGAIAGivenName(const base::string16& name);
67 void SetGAIAPicture(const gfx::Image* image);
68 void SetIsUsingGAIAPicture(bool value);
69 void SetIsSigninRequired(bool value);
70 void SetIsEphemeral(bool value);
71 void SetIsUsingDefaultName(bool value);
72 void SetIsUsingDefaultAvatar(bool value);
73 void SetIsAuthError(bool value);
74 void SetAvatarIconIndex(size_t icon_index);
75
76 void SetAuthInfo(const std::string& gaia_id,
77 const base::string16& user_name);
78
79 private:
80 // These members are an implementation detail meant to smooth the migration
81 // of the ProfileInfoCache to the ProfileAttributesStorage interface. They can
82 // be safely removed once the ProfileInfoCache stops using indices
83 // internally.
84 // TODO(anthonyvd): Remove ProfileInfoCache related implementation details
85 // when this class holds the members required to fulfill its own contract.
86 friend class ProfileInfoCache;
87 void Initialize(ProfileInfoCache* cache, const base::FilePath& path);
88 size_t profile_index() const;
89 ProfileInfoCache* profile_info_cache_;
90 base::FilePath profile_path_;
91
92 DISALLOW_COPY_AND_ASSIGN(ProfileAttributesEntry);
93 };
94
95 #endif // CHROME_BROWSER_PROFILES_PROFILE_ATTRIBUTES_ENTRY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698