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

Unified Diff: components/autofill/core/browser/personal_data_manager.cc

Issue 2395243002: [Autofill] Log count histogram for the number of server cards (Closed)
Patch Set: addressed nits Created 4 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/autofill/core/browser/personal_data_manager.h ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/autofill/core/browser/personal_data_manager.cc
diff --git a/components/autofill/core/browser/personal_data_manager.cc b/components/autofill/core/browser/personal_data_manager.cc
index ace4f444c181eee328349c6e30db36927665aa9e..7efb5d7be132669eb10c90db5595307a6595823e 100644
--- a/components/autofill/core/browser/personal_data_manager.cc
+++ b/components/autofill/core/browser/personal_data_manager.cc
@@ -263,7 +263,8 @@ PersonalDataManager::PersonalDataManager(const std::string& app_locale)
account_tracker_(NULL),
is_off_the_record_(false),
has_logged_profile_count_(false),
- has_logged_credit_card_count_(false) {}
+ has_logged_local_credit_card_count_(false),
+ has_logged_server_credit_card_counts_(false) {}
void PersonalDataManager::Init(scoped_refptr<AutofillWebDataService> database,
PrefService* pref_service,
@@ -388,6 +389,8 @@ void PersonalDataManager::OnWebDataServiceRequestDone(
// disabled, force mask all cards back to the unsaved state.
if (!OfferStoreUnmaskedCards())
ResetFullServerCards();
+
+ LogServerCreditCardCounts();
}
break;
default:
@@ -1284,9 +1287,25 @@ void PersonalDataManager::LogProfileCount() const {
}
void PersonalDataManager::LogLocalCreditCardCount() const {
- if (!has_logged_credit_card_count_) {
+ if (!has_logged_local_credit_card_count_) {
AutofillMetrics::LogStoredLocalCreditCardCount(local_credit_cards_.size());
- has_logged_credit_card_count_ = true;
+ has_logged_local_credit_card_count_ = true;
+ }
+}
+
+void PersonalDataManager::LogServerCreditCardCounts() const {
+ if (!has_logged_server_credit_card_counts_) {
+ size_t unmasked_cards = 0, masked_cards = 0;
+ for (CreditCard* card : server_credit_cards_) {
+ if (card->record_type() == CreditCard::MASKED_SERVER_CARD) {
+ masked_cards++;
+ } else if (card->record_type() == CreditCard::FULL_SERVER_CARD) {
+ unmasked_cards++;
+ }
+ }
+ AutofillMetrics::LogStoredServerCreditCardCounts(masked_cards,
+ unmasked_cards);
+ has_logged_server_credit_card_counts_ = true;
}
}
« no previous file with comments | « components/autofill/core/browser/personal_data_manager.h ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698