#include "components/autofill/core/browser/payments/local_card_migration_manager.h"
#include <stddef.h>
#include <algorithm>
#include <unordered_map>
#include <vector>
#include "base/check_deref.h"
#include "base/containers/contains.h"
#include "base/functional/bind.h"
#include "base/metrics/histogram_functions.h"
#include "base/strings/utf_string_conversions.h"
#include "components/autofill/core/browser/autofill_client.h"
#include "components/autofill/core/browser/autofill_experiments.h"
#include "components/autofill/core/browser/data_model/credit_card.h"
#include "components/autofill/core/browser/form_data_importer.h"
#include "components/autofill/core/browser/metrics/autofill_metrics.h"
#include "components/autofill/core/browser/metrics/payments/local_card_migration_metrics.h"
#include "components/autofill/core/browser/payments/client_behavior_constants.h"
#include "components/autofill/core/browser/payments/credit_card_save_manager.h"
#include "components/autofill/core/browser/payments/payments_network_interface.h"
#include "components/autofill/core/browser/payments/payments_util.h"
#include "components/autofill/core/browser/payments_data_manager.h"
#include "components/autofill/core/browser/personal_data_manager.h"
#include "components/autofill/core/common/autofill_features.h"
#include "components/autofill/core/common/autofill_payments_features.h"
#include "components/signin/public/identity_manager/identity_manager.h"
namespace autofill {
namespace {
PaymentsRpcResult;
}
MigratableCreditCard::MigratableCreditCard(const CreditCard& credit_card)
: … { … }
MigratableCreditCard::MigratableCreditCard(const MigratableCreditCard&) =
default;
MigratableCreditCard::MigratableCreditCard(MigratableCreditCard&&) = default;
MigratableCreditCard& MigratableCreditCard::operator=(
const MigratableCreditCard&) = default;
MigratableCreditCard& MigratableCreditCard::operator=(MigratableCreditCard&&) =
default;
MigratableCreditCard::~MigratableCreditCard() = default;
LocalCardMigrationManager::LocalCardMigrationManager(
AutofillClient* client,
const std::string& app_locale)
: … { … }
LocalCardMigrationManager::~LocalCardMigrationManager() = default;
bool LocalCardMigrationManager::ShouldOfferLocalCardMigration(
const std::optional<CreditCard>& extracted_credit_card,
int credit_card_import_type) { … }
void LocalCardMigrationManager::AttemptToOfferLocalCardMigration(
bool is_from_settings_page) { … }
void LocalCardMigrationManager::OnUserAcceptedIntermediateMigrationDialog() { … }
void LocalCardMigrationManager::OnUserAcceptedMainMigrationDialog(
const std::vector<std::string>& selected_card_guids) { … }
void LocalCardMigrationManager::OnUserDeletedLocalCardViaMigrationDialog(
const std::string& deleted_card_guid) { … }
bool LocalCardMigrationManager::IsCreditCardMigrationEnabled() { … }
void LocalCardMigrationManager::OnDidGetUploadDetails(
bool is_from_settings_page,
PaymentsRpcResult result,
const std::u16string& context_token,
std::unique_ptr<base::Value::Dict> legal_message,
std::vector<std::pair<int, int>> supported_card_bin_ranges) { … }
void LocalCardMigrationManager::OnDidMigrateLocalCards(
PaymentsRpcResult result,
std::unique_ptr<std::unordered_map<std::string, std::string>> save_result,
const std::string& display_text) { … }
void LocalCardMigrationManager::OnDidGetMigrationRiskData(
const std::string& risk_data) { … }
void LocalCardMigrationManager::SendMigrateLocalCardsRequest() { … }
LocalCardMigrationStrikeDatabase*
LocalCardMigrationManager::GetLocalCardMigrationStrikeDatabase() { … }
void LocalCardMigrationManager::ShowMainMigrationDialog() { … }
int LocalCardMigrationManager::GetDetectedValues() const { … }
void LocalCardMigrationManager::GetMigratableCreditCards() { … }
void LocalCardMigrationManager::FilterOutUnsupportedLocalCards(
const std::vector<std::pair<int, int>>& supported_card_bin_ranges) { … }
PaymentsDataManager& LocalCardMigrationManager::payments_data_manager() { … }
const PaymentsDataManager& LocalCardMigrationManager::payments_data_manager()
const { … }
}