| 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::HasStatsBrowsingHistory() const { |
| 134 return profile_info_cache_->HasStatsBrowsingHistoryOfProfileAtIndex( |
| 135 profile_index()); |
| 136 } |
| 137 |
| 138 int ProfileAttributesEntry::GetStatsBrowsingHistory() const { |
| 139 return profile_info_cache_->GetStatsBrowsingHistoryOfProfileAtIndex( |
| 140 profile_index()); |
| 141 } |
| 142 |
| 143 bool ProfileAttributesEntry::HasStatsPasswords() const { |
| 144 return profile_info_cache_->HasStatsPasswordsOfProfileAtIndex( |
| 145 profile_index()); |
| 146 } |
| 147 |
| 148 int ProfileAttributesEntry::GetStatsPasswords() const { |
| 149 return profile_info_cache_->GetStatsPasswordsOfProfileAtIndex( |
| 150 profile_index()); |
| 151 } |
| 152 |
| 153 bool ProfileAttributesEntry::HasStatsBookmarks() const { |
| 154 return profile_info_cache_->HasStatsBookmarksOfProfileAtIndex( |
| 155 profile_index()); |
| 156 } |
| 157 |
| 158 int ProfileAttributesEntry::GetStatsBookmarks() const { |
| 159 return profile_info_cache_->GetStatsBookmarksOfProfileAtIndex( |
| 160 profile_index()); |
| 161 } |
| 162 |
| 163 bool ProfileAttributesEntry::HasStatsSettings() const { |
| 164 return profile_info_cache_->HasStatsSettingsOfProfileAtIndex(profile_index()); |
| 165 } |
| 166 |
| 167 int ProfileAttributesEntry::GetStatsSettings() const { |
| 168 return profile_info_cache_->GetStatsSettingsOfProfileAtIndex(profile_index()); |
| 169 } |
| 170 |
| 133 void ProfileAttributesEntry::SetName(const base::string16& name) { | 171 void ProfileAttributesEntry::SetName(const base::string16& name) { |
| 134 profile_info_cache_->SetNameOfProfileAtIndex(profile_index(), name); | 172 profile_info_cache_->SetNameOfProfileAtIndex(profile_index(), name); |
| 135 } | 173 } |
| 136 | 174 |
| 137 void ProfileAttributesEntry::SetShortcutName(const base::string16& name) { | 175 void ProfileAttributesEntry::SetShortcutName(const base::string16& name) { |
| 138 profile_info_cache_->SetShortcutNameOfProfileAtIndex(profile_index(), name); | 176 profile_info_cache_->SetShortcutNameOfProfileAtIndex(profile_index(), name); |
| 139 } | 177 } |
| 140 | 178 |
| 141 void ProfileAttributesEntry::SetIsOmitted(bool is_omitted) { | 179 void ProfileAttributesEntry::SetIsOmitted(bool is_omitted) { |
| 142 profile_info_cache_->SetIsOmittedProfileAtIndex(profile_index(), is_omitted); | 180 profile_info_cache_->SetIsOmittedProfileAtIndex(profile_index(), is_omitted); |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 | 237 |
| 200 void ProfileAttributesEntry::SetIsAuthError(bool value) { | 238 void ProfileAttributesEntry::SetIsAuthError(bool value) { |
| 201 profile_info_cache_->SetProfileIsAuthErrorAtIndex(profile_index(), value); | 239 profile_info_cache_->SetProfileIsAuthErrorAtIndex(profile_index(), value); |
| 202 } | 240 } |
| 203 | 241 |
| 204 void ProfileAttributesEntry::SetAvatarIconIndex(size_t icon_index) { | 242 void ProfileAttributesEntry::SetAvatarIconIndex(size_t icon_index) { |
| 205 profile_info_cache_->SetAvatarIconOfProfileAtIndex( | 243 profile_info_cache_->SetAvatarIconOfProfileAtIndex( |
| 206 profile_index(), icon_index); | 244 profile_index(), icon_index); |
| 207 } | 245 } |
| 208 | 246 |
| 247 void ProfileAttributesEntry::SetStatsBrowsingHistory(int value) { |
| 248 profile_info_cache_->SetStatsBrowsingHistoryOfProfileAtIndex(profile_index(), |
| 249 value); |
| 250 } |
| 251 |
| 252 void ProfileAttributesEntry::SetStatsPasswords(int value) { |
| 253 profile_info_cache_->SetStatsPasswordsOfProfileAtIndex(profile_index(), |
| 254 value); |
| 255 } |
| 256 |
| 257 void ProfileAttributesEntry::SetStatsBookmarks(int value) { |
| 258 profile_info_cache_->SetStatsBookmarksOfProfileAtIndex(profile_index(), |
| 259 value); |
| 260 } |
| 261 |
| 262 void ProfileAttributesEntry::SetStatsSettings(int value) { |
| 263 profile_info_cache_->SetStatsSettingsOfProfileAtIndex(profile_index(), value); |
| 264 } |
| 265 |
| 209 void ProfileAttributesEntry::SetAuthInfo( | 266 void ProfileAttributesEntry::SetAuthInfo( |
| 210 const std::string& gaia_id, const base::string16& user_name) { | 267 const std::string& gaia_id, const base::string16& user_name) { |
| 211 profile_info_cache_->SetAuthInfoOfProfileAtIndex( | 268 profile_info_cache_->SetAuthInfoOfProfileAtIndex( |
| 212 profile_index(), gaia_id, user_name); | 269 profile_index(), gaia_id, user_name); |
| 213 } | 270 } |
| 214 | 271 |
| 215 size_t ProfileAttributesEntry::profile_index() const { | 272 size_t ProfileAttributesEntry::profile_index() const { |
| 216 size_t index = profile_info_cache_->GetIndexOfProfileWithPath(profile_path_); | 273 size_t index = profile_info_cache_->GetIndexOfProfileWithPath(profile_path_); |
| 217 DCHECK(index < profile_info_cache_->GetNumberOfProfiles()); | 274 DCHECK(index < profile_info_cache_->GetNumberOfProfiles()); |
| 218 return index; | 275 return index; |
| 219 } | 276 } |
| OLD | NEW |