Index: components/autofill/core/browser/autofill_manager.cc |
diff --git a/components/autofill/core/browser/autofill_manager.cc b/components/autofill/core/browser/autofill_manager.cc |
index 56b42b3e37bd4ee7fd28d620cf2c84d4db44ac4b..c6af795fb02bd34a02c631a305e31debbc8107ff 100644 |
--- a/components/autofill/core/browser/autofill_manager.cc |
+++ b/components/autofill/core/browser/autofill_manager.cc |
@@ -58,6 +58,7 @@ |
#include "components/autofill/core/common/password_form_fill_data.h" |
#include "components/pref_registry/pref_registry_syncable.h" |
#include "components/prefs/pref_service.h" |
+#include "components/rappor/rappor_utils.h" |
#include "google_apis/gaia/identity_provider.h" |
#include "grit/components_strings.h" |
#include "ui/base/l10n/l10n_util.h" |
@@ -1076,13 +1077,16 @@ void AutofillManager::ImportFormData(const FormStructure& submitted_form) { |
if (upload_request_.cvc.empty()) { |
AutofillMetrics::LogCardUploadDecisionMetric( |
AutofillMetrics::UPLOAD_NOT_OFFERED_NO_CVC); |
+ CollectRapportSample(submitted_form.source_url(), |
+ "Autofill.CardUploadNotOfferedNoCvc"); |
return; |
} |
// Upload also requires recently used or modified addresses that meet the |
// client-side validation rules. |
if (!GetProfilesForCreditCardUpload(*imported_credit_card, |
- &upload_request_.profiles)) { |
+ &upload_request_.profiles, |
+ submitted_form.source_url())) { |
return; |
} |
@@ -1093,7 +1097,8 @@ void AutofillManager::ImportFormData(const FormStructure& submitted_form) { |
bool AutofillManager::GetProfilesForCreditCardUpload( |
const CreditCard& card, |
- std::vector<AutofillProfile>* profiles) const { |
+ std::vector<AutofillProfile>* profiles, |
+ const GURL& source_url) const { |
std::vector<AutofillProfile> candidate_profiles; |
const base::Time now = base::Time::Now(); |
const base::TimeDelta fifteen_minutes = base::TimeDelta::FromMinutes(15); |
@@ -1108,6 +1113,7 @@ bool AutofillManager::GetProfilesForCreditCardUpload( |
if (candidate_profiles.empty()) { |
AutofillMetrics::LogCardUploadDecisionMetric( |
AutofillMetrics::UPLOAD_NOT_OFFERED_NO_ADDRESS); |
+ CollectRapportSample(source_url, "Autofill.CardUploadNotOfferedNoAddress"); |
return false; |
} |
@@ -1137,6 +1143,8 @@ bool AutofillManager::GetProfilesForCreditCardUpload( |
verified_name, RemoveMiddleInitial(address_name))) { |
AutofillMetrics::LogCardUploadDecisionMetric( |
AutofillMetrics::UPLOAD_NOT_OFFERED_CONFLICTING_NAMES); |
+ CollectRapportSample(source_url, |
+ "Autofill.CardUploadNotOfferedConflictingNames"); |
return false; |
} |
} |
@@ -1147,6 +1155,7 @@ bool AutofillManager::GetProfilesForCreditCardUpload( |
if (verified_name.empty()) { |
AutofillMetrics::LogCardUploadDecisionMetric( |
AutofillMetrics::UPLOAD_NOT_OFFERED_NO_NAME); |
+ CollectRapportSample(source_url, "Autofill.CardUploadNotOfferedNoName"); |
return false; |
} |
@@ -1192,6 +1201,14 @@ bool AutofillManager::GetProfilesForCreditCardUpload( |
return true; |
} |
+void AutofillManager::CollectRapportSample(const GURL& source_url, |
+ const char* metric_name) const { |
+ if (source_url.is_valid() && client_->GetRapporService()) { |
+ rappor::SampleDomainAndRegistryFromGURL(client_->GetRapporService(), |
+ metric_name, source_url); |
+ } |
+} |
+ |
// Note that |submitted_form| is passed as a pointer rather than as a reference |
// so that we can get memory management right across threads. Note also that we |
// explicitly pass in all the time stamps of interest, as the cached ones might |