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

Side by Side Diff: components/autofill/core/browser/personal_data_manager.cc

Issue 1839583003: [Autofill] Log the number of stored local credit cards (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 months 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "components/autofill/core/browser/personal_data_manager.h" 5 #include "components/autofill/core/browser/personal_data_manager.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <algorithm> 8 #include <algorithm>
9 #include <list> 9 #include <list>
10 #include <map> 10 #include <map>
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 : database_(NULL), 205 : database_(NULL),
206 is_data_loaded_(false), 206 is_data_loaded_(false),
207 pending_profiles_query_(0), 207 pending_profiles_query_(0),
208 pending_server_profiles_query_(0), 208 pending_server_profiles_query_(0),
209 pending_creditcards_query_(0), 209 pending_creditcards_query_(0),
210 pending_server_creditcards_query_(0), 210 pending_server_creditcards_query_(0),
211 app_locale_(app_locale), 211 app_locale_(app_locale),
212 pref_service_(NULL), 212 pref_service_(NULL),
213 account_tracker_(NULL), 213 account_tracker_(NULL),
214 is_off_the_record_(false), 214 is_off_the_record_(false),
215 has_logged_profile_count_(false) {} 215 has_logged_profile_count_(false),
216 has_logged_credit_card_count_(false) {}
216 217
217 void PersonalDataManager::Init(scoped_refptr<AutofillWebDataService> database, 218 void PersonalDataManager::Init(scoped_refptr<AutofillWebDataService> database,
218 PrefService* pref_service, 219 PrefService* pref_service,
219 AccountTrackerService* account_tracker, 220 AccountTrackerService* account_tracker,
220 SigninManagerBase* signin_manager, 221 SigninManagerBase* signin_manager,
221 bool is_off_the_record) { 222 bool is_off_the_record) {
222 CountryNames::SetLocaleString(app_locale_); 223 CountryNames::SetLocaleString(app_locale_);
223 224
224 database_ = database; 225 database_ = database;
225 SetPrefService(pref_service); 226 SetPrefService(pref_service);
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
289 DCHECK(!email.empty()); 290 DCHECK(!email.empty());
290 for (AutofillProfile* profile : server_profiles_) 291 for (AutofillProfile* profile : server_profiles_)
291 profile->SetRawInfo(EMAIL_ADDRESS, email); 292 profile->SetRawInfo(EMAIL_ADDRESS, email);
292 } 293 }
293 } 294 }
294 break; 295 break;
295 case AUTOFILL_CREDITCARDS_RESULT: 296 case AUTOFILL_CREDITCARDS_RESULT:
296 if (h == pending_creditcards_query_) { 297 if (h == pending_creditcards_query_) {
297 ReceiveLoadedDbValues(h, result, &pending_creditcards_query_, 298 ReceiveLoadedDbValues(h, result, &pending_creditcards_query_,
298 &local_credit_cards_); 299 &local_credit_cards_);
300 LogLocalCreditCardCount();
299 } else { 301 } else {
300 ReceiveLoadedDbValues(h, result, &pending_server_creditcards_query_, 302 ReceiveLoadedDbValues(h, result, &pending_server_creditcards_query_,
301 &server_credit_cards_); 303 &server_credit_cards_);
302 304
303 // If the user has a saved unmasked server card and the experiment is 305 // If the user has a saved unmasked server card and the experiment is
304 // disabled, force mask all cards back to the unsaved state. 306 // disabled, force mask all cards back to the unsaved state.
305 if (!OfferStoreUnmaskedCards()) 307 if (!OfferStoreUnmaskedCards())
306 ResetFullServerCards(); 308 ResetFullServerCards();
307 } 309 }
308 break; 310 break;
(...skipping 875 matching lines...) Expand 10 before | Expand all | Expand 10 after
1184 return guid; 1186 return guid;
1185 } 1187 }
1186 1188
1187 void PersonalDataManager::LogProfileCount() const { 1189 void PersonalDataManager::LogProfileCount() const {
1188 if (!has_logged_profile_count_) { 1190 if (!has_logged_profile_count_) {
1189 AutofillMetrics::LogStoredProfileCount(web_profiles_.size()); 1191 AutofillMetrics::LogStoredProfileCount(web_profiles_.size());
1190 has_logged_profile_count_ = true; 1192 has_logged_profile_count_ = true;
1191 } 1193 }
1192 } 1194 }
1193 1195
1196 void PersonalDataManager::LogLocalCreditCardCount() const {
1197 if (!has_logged_credit_card_count_) {
1198 AutofillMetrics::LogStoredLocalCreditCardCount(local_credit_cards_.size());
1199 has_logged_credit_card_count_ = true;
1200 }
1201 }
1202
1194 std::string PersonalDataManager::MostCommonCountryCodeFromProfiles() const { 1203 std::string PersonalDataManager::MostCommonCountryCodeFromProfiles() const {
1195 if (!IsAutofillEnabled()) 1204 if (!IsAutofillEnabled())
1196 return std::string(); 1205 return std::string();
1197 1206
1198 // Count up country codes from existing profiles. 1207 // Count up country codes from existing profiles.
1199 std::map<std::string, int> votes; 1208 std::map<std::string, int> votes;
1200 // TODO(estade): can we make this GetProfiles() instead? It seems to cause 1209 // TODO(estade): can we make this GetProfiles() instead? It seems to cause
1201 // errors in tests on mac trybots. See http://crbug.com/57221 1210 // errors in tests on mac trybots. See http://crbug.com/57221
1202 const std::vector<AutofillProfile*>& profiles = web_profiles(); 1211 const std::vector<AutofillProfile*>& profiles = web_profiles();
1203 const std::vector<std::string>& country_codes = 1212 const std::vector<std::string>& country_codes =
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
1411 web_profiles().end()); 1420 web_profiles().end());
1412 if (IsExperimentalWalletIntegrationEnabled() && 1421 if (IsExperimentalWalletIntegrationEnabled() &&
1413 pref_service_->GetBoolean(prefs::kAutofillWalletImportEnabled)) { 1422 pref_service_->GetBoolean(prefs::kAutofillWalletImportEnabled)) {
1414 profiles_.insert( 1423 profiles_.insert(
1415 profiles_.end(), server_profiles_.begin(), server_profiles_.end()); 1424 profiles_.end(), server_profiles_.begin(), server_profiles_.end());
1416 } 1425 }
1417 return profiles_; 1426 return profiles_;
1418 } 1427 }
1419 1428
1420 } // namespace autofill 1429 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698