#include "components/plus_addresses/metrics/plus_address_submission_logger.h"
#include <memory>
#include <utility>
#include "base/check_deref.h"
#include "base/containers/flat_map.h"
#include "base/metrics/histogram_functions.h"
#include "base/notreached.h"
#include "base/scoped_multi_source_observation.h"
#include "base/strings/utf_string_conversions.h"
#include "base/types/cxx23_to_underlying.h"
#include "components/autofill/core/browser/autofill_client.h"
#include "components/autofill/core/browser/autofill_field.h"
#include "components/autofill/core/browser/autofill_manager.h"
#include "components/autofill/core/browser/autofill_plus_address_delegate.h"
#include "components/autofill/core/browser/data_model/borrowed_transliterator.h"
#include "components/autofill/core/browser/form_structure.h"
#include "components/autofill/core/browser/ui/suggestion_type.h"
#include "components/autofill/core/common/unique_ids.h"
#include "components/commerce/core/heuristics/commerce_heuristics_provider.h"
#include "components/signin/public/base/consent_level.h"
#include "components/signin/public/identity_manager/account_info.h"
#include "components/signin/public/identity_manager/identity_manager.h"
#include "services/metrics/public/cpp/metrics_utils.h"
#include "services/metrics/public/cpp/ukm_builders.h"
namespace plus_addresses::metrics {
namespace {
AutofillField;
FieldGlobalId;
FormFieldData;
FormGlobalId;
FormStructure;
SuggestionType;
enum class PlusAddressCountBucket { … };
PlusAddressCountBucket ToPlusAddressCountBucket(size_t count) { … }
bool IsCartOrCheckoutUrl(const GURL& url) { … }
bool IsPlusAddressCreationSuggestion(SuggestionType suggestion_type) { … }
}
PlusAddressSubmissionLogger::Record::Record(
ukm::SourceId source_id,
bool is_single_field_in_renderer_form,
bool is_first_time_user)
: … { … }
PlusAddressSubmissionLogger::Record::Record(Record&&) = default;
PlusAddressSubmissionLogger::Record&
PlusAddressSubmissionLogger::Record::operator=(Record&&) = default;
PlusAddressSubmissionLogger::Record::~Record() = default;
PlusAddressSubmissionLogger::PlusAddressSubmissionLogger(
signin::IdentityManager* identity_manager,
PlusAddressVerifier plus_address_verifier)
: … { … }
PlusAddressSubmissionLogger::~PlusAddressSubmissionLogger() = default;
void PlusAddressSubmissionLogger::OnPlusAddressSuggestionShown(
autofill::AutofillManager& manager,
FormGlobalId form,
FieldGlobalId field,
autofill::AutofillPlusAddressDelegate::SuggestionContext suggestion_context,
autofill::AutofillClient::PasswordFormClassification::Type form_type,
SuggestionType suggestion_type,
size_t plus_address_count) { … }
void PlusAddressSubmissionLogger::OnAutofillManagerStateChanged(
autofill::AutofillManager& manager,
autofill::AutofillManager::LifecycleState old_state,
autofill::AutofillManager::LifecycleState new_state) { … }
void PlusAddressSubmissionLogger::OnFormSubmitted(
autofill::AutofillManager& manager,
const autofill::FormData& form) { … }
void PlusAddressSubmissionLogger::RemoveManagerObservation(
autofill::AutofillManager& manager) { … }
}