Commit 6bb61c72 authored by Jaeyong Bae's avatar Jaeyong Bae Committed by Commit Bot

[Autofill] Move merge logic methods out of the PDM

This patch means refactor function name according what function do.
And, it might make sense to move the static merge functions to
autofill_profile_comparator which has functions related to merge logic.

Bug: 913940
Change-Id: I5a6d71b45fadf225e33541dc2b3a17bb7794ec1e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1885864Reviewed-by: default avatarsebsg <sebsg@chromium.org>
Commit-Queue: sebsg <sebsg@chromium.org>
Cr-Commit-Position: refs/heads/master@{#710353}
parent 0f5f6e94
......@@ -663,17 +663,6 @@ class PersonalDataManager : public KeyedService,
server_id_profiles_map,
std::unordered_map<std::string, std::string>* guids_merge_map) const;
// Tries to merge the |server_address| into the |existing_profiles| if
// possible. Adds it to the list if no match is found. The existing profiles
// should be sorted by decreasing frecency outside of this method, since this
// will be called multiple times in a row. Returns the guid of the new or
// updated profile.
static std::string MergeServerAddressesIntoProfiles(
const AutofillProfile& server_address,
std::vector<AutofillProfile>* existing_profiles,
const std::string& app_locale,
const std::string& primary_account_email);
// Removes profile from web database according to |guid| and resets credit
// card's billing address if that address is used by any credit cards.
// The method does not refresh, this allows multiple removal with one
......
......@@ -31,8 +31,7 @@ namespace {
const int LOCAL_GUID_LENGTH = 36;
// TODO(crbug.com/687975): Reuse MergeProfile in this function.
// static
std::string MergeServerAddressesIntoProfiles(
std::string MergeServerAddressesIntoProfilesAndUpdateDb(
const AutofillProfile& server_address,
std::vector<std::unique_ptr<AutofillProfile>>* existing_profiles,
const std::string& app_locale,
......@@ -94,7 +93,7 @@ bool ConvertWalletAddressesToLocalProfiles(
if (!wallet_address->has_converted()) {
// Try to merge the server address into a similar local profile, or create
// a new local profile if no similar profile is found.
std::string address_guid = MergeServerAddressesIntoProfiles(
std::string address_guid = MergeServerAddressesIntoProfilesAndUpdateDb(
*wallet_address, local_profiles, app_locale, primary_account_email,
backend, db);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment