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

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

Issue 1415223002: Add counts of User data to ProfileInfoCache (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Change GetStatistic from int(...) back to bool(..., int*) Created 5 years, 1 month 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
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
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_->GetAllStatisticsOfProfileAtIndex(profile_index());
141 }
142
133 void ProfileAttributesEntry::SetName(const base::string16& name) { 143 void ProfileAttributesEntry::SetName(const base::string16& name) {
134 profile_info_cache_->SetNameOfProfileAtIndex(profile_index(), name); 144 profile_info_cache_->SetNameOfProfileAtIndex(profile_index(), name);
135 } 145 }
136 146
137 void ProfileAttributesEntry::SetShortcutName(const base::string16& name) { 147 void ProfileAttributesEntry::SetShortcutName(const base::string16& name) {
138 profile_info_cache_->SetShortcutNameOfProfileAtIndex(profile_index(), name); 148 profile_info_cache_->SetShortcutNameOfProfileAtIndex(profile_index(), name);
139 } 149 }
140 150
141 void ProfileAttributesEntry::SetIsOmitted(bool is_omitted) { 151 void ProfileAttributesEntry::SetIsOmitted(bool is_omitted) {
142 profile_info_cache_->SetIsOmittedProfileAtIndex(profile_index(), is_omitted); 152 profile_info_cache_->SetIsOmittedProfileAtIndex(profile_index(), is_omitted);
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 209
200 void ProfileAttributesEntry::SetIsAuthError(bool value) { 210 void ProfileAttributesEntry::SetIsAuthError(bool value) {
201 profile_info_cache_->SetProfileIsAuthErrorAtIndex(profile_index(), value); 211 profile_info_cache_->SetProfileIsAuthErrorAtIndex(profile_index(), value);
202 } 212 }
203 213
204 void ProfileAttributesEntry::SetAvatarIconIndex(size_t icon_index) { 214 void ProfileAttributesEntry::SetAvatarIconIndex(size_t icon_index) {
205 profile_info_cache_->SetAvatarIconOfProfileAtIndex( 215 profile_info_cache_->SetAvatarIconOfProfileAtIndex(
206 profile_index(), icon_index); 216 profile_index(), icon_index);
207 } 217 }
208 218
219 void ProfileAttributesEntry::SetStatistic(const std::string& category,
220 int value) {
221 profile_info_cache_->SetStatisticOfProfileAtIndex(
222 profile_index(), category, value);
223 }
224
209 void ProfileAttributesEntry::SetAuthInfo( 225 void ProfileAttributesEntry::SetAuthInfo(
210 const std::string& gaia_id, const base::string16& user_name) { 226 const std::string& gaia_id, const base::string16& user_name) {
211 profile_info_cache_->SetAuthInfoOfProfileAtIndex( 227 profile_info_cache_->SetAuthInfoOfProfileAtIndex(
212 profile_index(), gaia_id, user_name); 228 profile_index(), gaia_id, user_name);
213 } 229 }
214 230
215 size_t ProfileAttributesEntry::profile_index() const { 231 size_t ProfileAttributesEntry::profile_index() const {
216 size_t index = profile_info_cache_->GetIndexOfProfileWithPath(profile_path_); 232 size_t index = profile_info_cache_->GetIndexOfProfileWithPath(profile_path_);
217 DCHECK(index < profile_info_cache_->GetNumberOfProfiles()); 233 DCHECK(index < profile_info_cache_->GetNumberOfProfiles());
218 return index; 234 return index;
219 } 235 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698