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

Unified Diff: chrome/browser/autofill/personal_data_manager.cc

Issue 6903091: Autofill Multi-Value: Additional profiles with same name and address not added to DOM UI (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address nits. Created 9 years, 8 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 | « chrome/browser/autofill/credit_card.cc ('k') | chrome/browser/autofill/personal_data_manager_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/autofill/personal_data_manager.cc
diff --git a/chrome/browser/autofill/personal_data_manager.cc b/chrome/browser/autofill/personal_data_manager.cc
index 6796a9695eb74984d756ea1185fe636f8fdbbae3..0684c72fce8b7c0b9dcd099744dd3ef37f7ff78a 100644
--- a/chrome/browser/autofill/personal_data_manager.cc
+++ b/chrome/browser/autofill/personal_data_manager.cc
@@ -450,19 +450,15 @@ void PersonalDataManager::SetCreditCards(
FOR_EACH_OBSERVER(Observer, observers_, OnPersonalDataChanged());
}
-// TODO(jhawkins): Refactor SetProfiles so this isn't so hacky.
+// TODO(dhollowa): Refactor to eliminate batch update of |SetProfiles|.
+// http://crbug.com/73068
void PersonalDataManager::AddProfile(const AutofillProfile& profile) {
- // Don't save a web profile if the data in the profile is a subset of an
- // auxiliary profile.
- for (std::vector<AutofillProfile*>::const_iterator iter =
- auxiliary_profiles_.begin();
- iter != auxiliary_profiles_.end(); ++iter) {
- if (profile.IsSubsetOf(**iter))
- return;
- }
+ std::vector<AutofillProfile> profiles(web_profiles_.size());
+ std::transform(web_profiles_.begin(), web_profiles_.end(),
+ profiles.begin(),
+ DereferenceFunctor<AutofillProfile>());
- std::vector<AutofillProfile> profiles;
- MergeProfile(profile, web_profiles_.get(), &profiles);
+ profiles.push_back(profile);
SetProfiles(&profiles);
}
@@ -488,8 +484,9 @@ void PersonalDataManager::UpdateProfile(const AutofillProfile& profile) {
FOR_EACH_OBSERVER(Observer, observers_, OnPersonalDataChanged());
}
+// TODO(dhollowa): Refactor to eliminate batch update of |SetProfiles|.
+// http://crbug.com/73068
void PersonalDataManager::RemoveProfile(const std::string& guid) {
- // TODO(jhawkins): Refactor SetProfiles so this isn't so hacky.
std::vector<AutofillProfile> profiles(web_profiles_.size());
std::transform(web_profiles_.begin(), web_profiles_.end(),
profiles.begin(),
@@ -514,7 +511,8 @@ AutofillProfile* PersonalDataManager::GetProfileByGUID(
return NULL;
}
-// TODO(jhawkins): Refactor SetCreditCards so this isn't so hacky.
+// TODO(dhollowa): Refactor to eliminate batch update of |SetCreditCards|.
+// http://crbug.com/73068
void PersonalDataManager::AddCreditCard(const CreditCard& credit_card) {
std::vector<CreditCard> credit_cards(credit_cards_.size());
std::transform(credit_cards_.begin(), credit_cards_.end(),
@@ -544,8 +542,9 @@ void PersonalDataManager::UpdateCreditCard(const CreditCard& credit_card) {
FOR_EACH_OBSERVER(Observer, observers_, OnPersonalDataChanged());
}
+// TODO(dhollowa): Refactor to eliminate batch update of |SetCreditCards|.
+// http://crbug.com/73068
void PersonalDataManager::RemoveCreditCard(const std::string& guid) {
- // TODO(jhawkins): Refactor SetCreditCards so this isn't so hacky.
std::vector<CreditCard> credit_cards(credit_cards_.size());
std::transform(credit_cards_.begin(), credit_cards_.end(),
credit_cards.begin(),
@@ -839,7 +838,18 @@ void PersonalDataManager::SaveImportedProfile(
if (profile_->IsOffTheRecord())
return;
- AddProfile(imported_profile);
+ // Don't save a web profile if the data in the profile is a subset of an
+ // auxiliary profile.
+ for (std::vector<AutofillProfile*>::const_iterator iter =
+ auxiliary_profiles_.begin();
+ iter != auxiliary_profiles_.end(); ++iter) {
+ if (imported_profile.IsSubsetOf(**iter))
+ return;
+ }
+
+ std::vector<AutofillProfile> profiles;
+ MergeProfile(imported_profile, web_profiles_.get(), &profiles);
+ SetProfiles(&profiles);
}
« no previous file with comments | « chrome/browser/autofill/credit_card.cc ('k') | chrome/browser/autofill/personal_data_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698