| 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 int ProfileAttributesEntry::GetStatistic(const std::string& category) const { |
| 134 return profile_info_cache_->GetStatisticOfProfileAtIndex( |
| 135 profile_index(), category); |
| 136 } |
| 137 |
| 138 std::map<std::string, int> ProfileAttributesEntry::GetAllStatistics() const { |
| 139 return profile_info_cache_->GetAllStatisticsOfProfileAtIndex(profile_index()); |
| 140 } |
| 141 |
| 142 scoped_ptr<base::DictionaryValue> |
| 143 ProfileAttributesEntry::GetAllStatisticsAsDictionaryValue() const { |
| 144 return profile_info_cache_->GetAllStatisticsOfProfileAtIndexAsDictionaryValue( |
| 145 profile_index()).Pass(); |
| 146 } |
| 147 |
| 133 void ProfileAttributesEntry::SetName(const base::string16& name) { | 148 void ProfileAttributesEntry::SetName(const base::string16& name) { |
| 134 profile_info_cache_->SetNameOfProfileAtIndex(profile_index(), name); | 149 profile_info_cache_->SetNameOfProfileAtIndex(profile_index(), name); |
| 135 } | 150 } |
| 136 | 151 |
| 137 void ProfileAttributesEntry::SetShortcutName(const base::string16& name) { | 152 void ProfileAttributesEntry::SetShortcutName(const base::string16& name) { |
| 138 profile_info_cache_->SetShortcutNameOfProfileAtIndex(profile_index(), name); | 153 profile_info_cache_->SetShortcutNameOfProfileAtIndex(profile_index(), name); |
| 139 } | 154 } |
| 140 | 155 |
| 141 void ProfileAttributesEntry::SetIsOmitted(bool is_omitted) { | 156 void ProfileAttributesEntry::SetIsOmitted(bool is_omitted) { |
| 142 profile_info_cache_->SetIsOmittedProfileAtIndex(profile_index(), is_omitted); | 157 profile_info_cache_->SetIsOmittedProfileAtIndex(profile_index(), is_omitted); |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 | 214 |
| 200 void ProfileAttributesEntry::SetIsAuthError(bool value) { | 215 void ProfileAttributesEntry::SetIsAuthError(bool value) { |
| 201 profile_info_cache_->SetProfileIsAuthErrorAtIndex(profile_index(), value); | 216 profile_info_cache_->SetProfileIsAuthErrorAtIndex(profile_index(), value); |
| 202 } | 217 } |
| 203 | 218 |
| 204 void ProfileAttributesEntry::SetAvatarIconIndex(size_t icon_index) { | 219 void ProfileAttributesEntry::SetAvatarIconIndex(size_t icon_index) { |
| 205 profile_info_cache_->SetAvatarIconOfProfileAtIndex( | 220 profile_info_cache_->SetAvatarIconOfProfileAtIndex( |
| 206 profile_index(), icon_index); | 221 profile_index(), icon_index); |
| 207 } | 222 } |
| 208 | 223 |
| 224 void ProfileAttributesEntry::SetStatistic(const std::string& category, |
| 225 int value) { |
| 226 profile_info_cache_->SetStatisticOfProfileAtIndex( |
| 227 profile_index(), category, value); |
| 228 } |
| 229 |
| 209 void ProfileAttributesEntry::SetAuthInfo( | 230 void ProfileAttributesEntry::SetAuthInfo( |
| 210 const std::string& gaia_id, const base::string16& user_name) { | 231 const std::string& gaia_id, const base::string16& user_name) { |
| 211 profile_info_cache_->SetAuthInfoOfProfileAtIndex( | 232 profile_info_cache_->SetAuthInfoOfProfileAtIndex( |
| 212 profile_index(), gaia_id, user_name); | 233 profile_index(), gaia_id, user_name); |
| 213 } | 234 } |
| 214 | 235 |
| 215 size_t ProfileAttributesEntry::profile_index() const { | 236 size_t ProfileAttributesEntry::profile_index() const { |
| 216 size_t index = profile_info_cache_->GetIndexOfProfileWithPath(profile_path_); | 237 size_t index = profile_info_cache_->GetIndexOfProfileWithPath(profile_path_); |
| 217 DCHECK(index < profile_info_cache_->GetNumberOfProfiles()); | 238 DCHECK(index < profile_info_cache_->GetNumberOfProfiles()); |
| 218 return index; | 239 return index; |
| 219 } | 240 } |
| OLD | NEW |