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 #include "chrome/browser/profiles/profile_attributes_entry.h" | 5 #include "chrome/browser/profiles/profile_attributes_entry.h" |
6 #include "chrome/browser/profiles/profile_info_cache.h" | 6 #include "chrome/browser/profiles/profile_info_cache.h" |
7 | 7 |
8 ProfileAttributesEntry::ProfileAttributesEntry() | 8 ProfileAttributesEntry::ProfileAttributesEntry() |
9 : profile_info_cache_(nullptr), | 9 : profile_info_cache_(nullptr), |
10 profile_path_(base::FilePath()) {} | 10 profile_path_(base::FilePath()) {} |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 | 123 |
124 bool ProfileAttributesEntry::IsAuthError() const { | 124 bool ProfileAttributesEntry::IsAuthError() const { |
125 return profile_info_cache_->ProfileIsAuthErrorAtIndex(profile_index()); | 125 return profile_info_cache_->ProfileIsAuthErrorAtIndex(profile_index()); |
126 } | 126 } |
127 | 127 |
128 size_t ProfileAttributesEntry::GetAvatarIconIndex() const { | 128 size_t ProfileAttributesEntry::GetAvatarIconIndex() const { |
129 return profile_info_cache_->GetAvatarIconIndexOfProfileAtIndex( | 129 return profile_info_cache_->GetAvatarIconIndexOfProfileAtIndex( |
130 profile_index()); | 130 profile_index()); |
131 } | 131 } |
132 | 132 |
| 133 bool ProfileAttributesEntry::GetStatistic(const std::string& category, |
| 134 int* out_value) const { |
| 135 return profile_info_cache_->GetStatisticOfProfileAtIndex( |
| 136 profile_index(), category, out_value); |
| 137 } |
| 138 |
| 139 std::map<std::string, int> ProfileAttributesEntry::GetAllStatistics() const { |
| 140 return profile_info_cache_->GetAllStatisticOfProfileAtIndex(profile_index()); |
| 141 } |
| 142 |
| 143 scoped_ptr<base::DictionaryValue> |
| 144 ProfileAttributesEntry::GetAllStatisticsAsDictionaryValue() const { |
| 145 return profile_info_cache_->GetAllStatisticsOfProfileAtIndexAsDictionaryValue( |
| 146 profile_index()).Pass(); |
| 147 } |
| 148 |
133 void ProfileAttributesEntry::SetName(const base::string16& name) { | 149 void ProfileAttributesEntry::SetName(const base::string16& name) { |
134 profile_info_cache_->SetNameOfProfileAtIndex(profile_index(), name); | 150 profile_info_cache_->SetNameOfProfileAtIndex(profile_index(), name); |
135 } | 151 } |
136 | 152 |
137 void ProfileAttributesEntry::SetShortcutName(const base::string16& name) { | 153 void ProfileAttributesEntry::SetShortcutName(const base::string16& name) { |
138 profile_info_cache_->SetShortcutNameOfProfileAtIndex(profile_index(), name); | 154 profile_info_cache_->SetShortcutNameOfProfileAtIndex(profile_index(), name); |
139 } | 155 } |
140 | 156 |
141 void ProfileAttributesEntry::SetIsOmitted(bool is_omitted) { | 157 void ProfileAttributesEntry::SetIsOmitted(bool is_omitted) { |
142 profile_info_cache_->SetIsOmittedProfileAtIndex(profile_index(), is_omitted); | 158 profile_info_cache_->SetIsOmittedProfileAtIndex(profile_index(), is_omitted); |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 | 215 |
200 void ProfileAttributesEntry::SetIsAuthError(bool value) { | 216 void ProfileAttributesEntry::SetIsAuthError(bool value) { |
201 profile_info_cache_->SetProfileIsAuthErrorAtIndex(profile_index(), value); | 217 profile_info_cache_->SetProfileIsAuthErrorAtIndex(profile_index(), value); |
202 } | 218 } |
203 | 219 |
204 void ProfileAttributesEntry::SetAvatarIconIndex(size_t icon_index) { | 220 void ProfileAttributesEntry::SetAvatarIconIndex(size_t icon_index) { |
205 profile_info_cache_->SetAvatarIconOfProfileAtIndex( | 221 profile_info_cache_->SetAvatarIconOfProfileAtIndex( |
206 profile_index(), icon_index); | 222 profile_index(), icon_index); |
207 } | 223 } |
208 | 224 |
| 225 void ProfileAttributesEntry::SetStatistic(const std::string& category, |
| 226 int value) { |
| 227 profile_info_cache_->SetStatisticOfProfileAtIndex( |
| 228 profile_index(), category, value); |
| 229 } |
| 230 |
209 void ProfileAttributesEntry::SetAuthInfo( | 231 void ProfileAttributesEntry::SetAuthInfo( |
210 const std::string& gaia_id, const base::string16& user_name) { | 232 const std::string& gaia_id, const base::string16& user_name) { |
211 profile_info_cache_->SetAuthInfoOfProfileAtIndex( | 233 profile_info_cache_->SetAuthInfoOfProfileAtIndex( |
212 profile_index(), gaia_id, user_name); | 234 profile_index(), gaia_id, user_name); |
213 } | 235 } |
214 | 236 |
215 size_t ProfileAttributesEntry::profile_index() const { | 237 size_t ProfileAttributesEntry::profile_index() const { |
216 size_t index = profile_info_cache_->GetIndexOfProfileWithPath(profile_path_); | 238 size_t index = profile_info_cache_->GetIndexOfProfileWithPath(profile_path_); |
217 DCHECK(index < profile_info_cache_->GetNumberOfProfiles()); | 239 DCHECK(index < profile_info_cache_->GetNumberOfProfiles()); |
218 return index; | 240 return index; |
219 } | 241 } |
OLD | NEW |