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

Side by Side Diff: components/autofill/core/browser/personal_data_manager.cc

Issue 2412073003: Remove FOR_EACH_OBSERVER from autofill and password_manager components (Closed)
Patch Set: Created 4 years, 2 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 unified diff | Download patch
« no previous file with comments | « no previous file | components/autofill/core/browser/webdata/autofill_webdata_backend_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "components/autofill/core/browser/personal_data_manager.h" 5 #include "components/autofill/core/browser/personal_data_manager.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <list> 10 #include <list>
(...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after
442 // |imported_credit_card| with an extracted card. See .h for details of 442 // |imported_credit_card| with an extracted card. See .h for details of
443 // |should_return_local_card|. 443 // |should_return_local_card|.
444 bool cc_import = 444 bool cc_import =
445 ImportCreditCard(form, should_return_local_card, imported_credit_card); 445 ImportCreditCard(form, should_return_local_card, imported_credit_card);
446 // - ImportAddressProfiles may eventually save or update one or more address 446 // - ImportAddressProfiles may eventually save or update one or more address
447 // profiles. 447 // profiles.
448 bool address_import = ImportAddressProfiles(form); 448 bool address_import = ImportAddressProfiles(form);
449 if (cc_import || address_import) 449 if (cc_import || address_import)
450 return true; 450 return true;
451 451
452 FOR_EACH_OBSERVER(PersonalDataManagerObserver, observers_, 452 for (PersonalDataManagerObserver& observer : observers_)
453 OnInsufficientFormData()); 453 observer.OnInsufficientFormData();
454 return false; 454 return false;
455 } 455 }
456 456
457 void PersonalDataManager::RecordUseOf(const AutofillDataModel& data_model) { 457 void PersonalDataManager::RecordUseOf(const AutofillDataModel& data_model) {
458 if (is_off_the_record_ || !database_.get()) 458 if (is_off_the_record_ || !database_.get())
459 return; 459 return;
460 460
461 CreditCard* credit_card = GetCreditCardByGUID(data_model.guid()); 461 CreditCard* credit_card = GetCreditCardByGUID(data_model.guid());
462 if (credit_card) { 462 if (credit_card) {
463 credit_card->RecordAndLogUse(); 463 credit_card->RecordAndLogUse();
(...skipping 775 matching lines...) Expand 10 before | Expand all | Expand 10 after
1239 } 1239 }
1240 1240
1241 std::vector<AutofillProfile> profiles; 1241 std::vector<AutofillProfile> profiles;
1242 std::string guid = MergeProfile(imported_profile, web_profiles_.get(), 1242 std::string guid = MergeProfile(imported_profile, web_profiles_.get(),
1243 app_locale_, &profiles); 1243 app_locale_, &profiles);
1244 SetProfiles(&profiles); 1244 SetProfiles(&profiles);
1245 return guid; 1245 return guid;
1246 } 1246 }
1247 1247
1248 void PersonalDataManager::NotifyPersonalDataChanged() { 1248 void PersonalDataManager::NotifyPersonalDataChanged() {
1249 FOR_EACH_OBSERVER(PersonalDataManagerObserver, observers_, 1249 for (PersonalDataManagerObserver& observer : observers_)
1250 OnPersonalDataChanged()); 1250 observer.OnPersonalDataChanged();
1251 } 1251 }
1252 1252
1253 std::string PersonalDataManager::SaveImportedCreditCard( 1253 std::string PersonalDataManager::SaveImportedCreditCard(
1254 const CreditCard& imported_card) { 1254 const CreditCard& imported_card) {
1255 DCHECK(!imported_card.number().empty()); 1255 DCHECK(!imported_card.number().empty());
1256 if (is_off_the_record_) 1256 if (is_off_the_record_)
1257 return std::string(); 1257 return std::string();
1258 1258
1259 // Set to true if |imported_card| is merged into the credit card list. 1259 // Set to true if |imported_card| is merged into the credit card list.
1260 bool merged = false; 1260 bool merged = false;
(...skipping 514 matching lines...) Expand 10 before | Expand all | Expand 10 after
1775 if (profile_to_merge->IsVerified()) 1775 if (profile_to_merge->IsVerified())
1776 break; 1776 break;
1777 } 1777 }
1778 } 1778 }
1779 } 1779 }
1780 AutofillMetrics::LogNumberOfProfilesRemovedDuringDedupe( 1780 AutofillMetrics::LogNumberOfProfilesRemovedDuringDedupe(
1781 profiles_to_delete->size()); 1781 profiles_to_delete->size());
1782 } 1782 }
1783 1783
1784 } // namespace autofill 1784 } // namespace autofill
OLDNEW
« no previous file with comments | « no previous file | components/autofill/core/browser/webdata/autofill_webdata_backend_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698