| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 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_ATTRIBUTES_ENTRY_H_ | 5 #ifndef CHROME_BROWSER_PROFILES_PROFILE_ATTRIBUTES_ENTRY_H_ |
| 6 #define CHROME_BROWSER_PROFILES_PROFILE_ATTRIBUTES_ENTRY_H_ | 6 #define CHROME_BROWSER_PROFILES_PROFILE_ATTRIBUTES_ENTRY_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
| 11 #include "base/strings/string16.h" | 11 #include "base/strings/string16.h" |
| 12 #include "base/time/time.h" | 12 #include "base/time/time.h" |
| 13 #include "base/values.h" |
| 13 | 14 |
| 14 namespace gfx { | 15 namespace gfx { |
| 15 class Image; | 16 class Image; |
| 16 } | 17 } |
| 17 | 18 |
| 18 class ProfileInfoCache; | 19 class ProfileInfoCache; |
| 19 | 20 |
| 20 class ProfileAttributesEntry { | 21 class ProfileAttributesEntry { |
| 21 public: | 22 public: |
| 22 ProfileAttributesEntry(); | 23 ProfileAttributesEntry(); |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 // Returns true if the profile is signed in. | 77 // Returns true if the profile is signed in. |
| 77 bool IsAuthenticated() const; | 78 bool IsAuthenticated() const; |
| 78 // Returns true if the Profile is using the default avatar, which is one of | 79 // Returns true if the Profile is using the default avatar, which is one of |
| 79 // the profile icons selectable at profile creation. | 80 // the profile icons selectable at profile creation. |
| 80 bool IsUsingDefaultAvatar() const; | 81 bool IsUsingDefaultAvatar() const; |
| 81 // Returns true if the profile is signed in but is in an authentication error | 82 // Returns true if the profile is signed in but is in an authentication error |
| 82 // state. | 83 // state. |
| 83 bool IsAuthError() const; | 84 bool IsAuthError() const; |
| 84 // Returns the index of the default icon used by the profile. | 85 // Returns the index of the default icon used by the profile. |
| 85 size_t GetAvatarIconIndex() const; | 86 size_t GetAvatarIconIndex() const; |
| 87 // Get the statistic of a given |category| of the profile in |out_value| if |
| 88 // the statistic of the |category| exists. Returns true if succeed. |
| 89 bool GetStatistic(const std::string& category, int* out_value) const; |
| 90 // Returns all the statistics of the profile. |
| 91 std::map<std::string, int> GetAllStatistics() const; |
| 92 scoped_ptr<base::DictionaryValue> GetAllStatisticsAsDictionaryValue() const; |
| 86 | 93 |
| 87 void SetName(const base::string16& name); | 94 void SetName(const base::string16& name); |
| 88 void SetShortcutName(const base::string16& name); | 95 void SetShortcutName(const base::string16& name); |
| 89 void SetIsOmitted(bool is_omitted); | 96 void SetIsOmitted(bool is_omitted); |
| 90 void SetSupervisedUserId(const std::string& id); | 97 void SetSupervisedUserId(const std::string& id); |
| 91 void SetLocalAuthCredentials(const std::string& auth); | 98 void SetLocalAuthCredentials(const std::string& auth); |
| 92 void SetPasswordChangeDetectionToken(const std::string& token); | 99 void SetPasswordChangeDetectionToken(const std::string& token); |
| 93 void SetBackgroundStatus(bool running_background_apps); | 100 void SetBackgroundStatus(bool running_background_apps); |
| 94 void SetGAIAName(const base::string16& name); | 101 void SetGAIAName(const base::string16& name); |
| 95 void SetGAIAGivenName(const base::string16& name); | 102 void SetGAIAGivenName(const base::string16& name); |
| 96 void SetGAIAPicture(const gfx::Image* image); | 103 void SetGAIAPicture(const gfx::Image* image); |
| 97 void SetIsUsingGAIAPicture(bool value); | 104 void SetIsUsingGAIAPicture(bool value); |
| 98 void SetIsSigninRequired(bool value); | 105 void SetIsSigninRequired(bool value); |
| 99 void SetIsEphemeral(bool value); | 106 void SetIsEphemeral(bool value); |
| 100 void SetIsUsingDefaultName(bool value); | 107 void SetIsUsingDefaultName(bool value); |
| 101 void SetIsUsingDefaultAvatar(bool value); | 108 void SetIsUsingDefaultAvatar(bool value); |
| 102 void SetIsAuthError(bool value); | 109 void SetIsAuthError(bool value); |
| 103 void SetAvatarIconIndex(size_t icon_index); | 110 void SetAvatarIconIndex(size_t icon_index); |
| 111 void SetStatistic(const std::string& category, int value); |
| 104 | 112 |
| 105 void SetAuthInfo(const std::string& gaia_id, | 113 void SetAuthInfo(const std::string& gaia_id, |
| 106 const base::string16& user_name); | 114 const base::string16& user_name); |
| 107 | 115 |
| 108 private: | 116 private: |
| 109 // These members are an implementation detail meant to smooth the migration | 117 // These members are an implementation detail meant to smooth the migration |
| 110 // of the ProfileInfoCache to the ProfileAttributesStorage interface. They can | 118 // of the ProfileInfoCache to the ProfileAttributesStorage interface. They can |
| 111 // be safely removed once the ProfileInfoCache stops using indices | 119 // be safely removed once the ProfileInfoCache stops using indices |
| 112 // internally. | 120 // internally. |
| 113 // TODO(anthonyvd): Remove ProfileInfoCache related implementation details | 121 // TODO(anthonyvd): Remove ProfileInfoCache related implementation details |
| 114 // when this class holds the members required to fulfill its own contract. | 122 // when this class holds the members required to fulfill its own contract. |
| 115 friend class ProfileInfoCache; | 123 friend class ProfileInfoCache; |
| 116 void Initialize(ProfileInfoCache* cache, const base::FilePath& path); | 124 void Initialize(ProfileInfoCache* cache, const base::FilePath& path); |
| 117 size_t profile_index() const; | 125 size_t profile_index() const; |
| 118 ProfileInfoCache* profile_info_cache_; | 126 ProfileInfoCache* profile_info_cache_; |
| 119 base::FilePath profile_path_; | 127 base::FilePath profile_path_; |
| 120 | 128 |
| 121 DISALLOW_COPY_AND_ASSIGN(ProfileAttributesEntry); | 129 DISALLOW_COPY_AND_ASSIGN(ProfileAttributesEntry); |
| 122 }; | 130 }; |
| 123 | 131 |
| 124 #endif // CHROME_BROWSER_PROFILES_PROFILE_ATTRIBUTES_ENTRY_H_ | 132 #endif // CHROME_BROWSER_PROFILES_PROFILE_ATTRIBUTES_ENTRY_H_ |
| OLD | NEW |