| OLD | NEW |
| 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 #include <algorithm> | 8 #include <algorithm> |
| 9 #include <list> | 9 #include <list> |
| 10 #include <map> | 10 #include <map> |
| (...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 364 } | 364 } |
| 365 | 365 |
| 366 void PersonalDataManager::RemoveObserver( | 366 void PersonalDataManager::RemoveObserver( |
| 367 PersonalDataManagerObserver* observer) { | 367 PersonalDataManagerObserver* observer) { |
| 368 observers_.RemoveObserver(observer); | 368 observers_.RemoveObserver(observer); |
| 369 } | 369 } |
| 370 | 370 |
| 371 bool PersonalDataManager::ImportFormData( | 371 bool PersonalDataManager::ImportFormData( |
| 372 const FormStructure& form, | 372 const FormStructure& form, |
| 373 bool should_return_local_card, | 373 bool should_return_local_card, |
| 374 scoped_ptr<CreditCard>* imported_credit_card) { | 374 std::unique_ptr<CreditCard>* imported_credit_card) { |
| 375 // We try the same |form| for both credit card and address import/update. | 375 // We try the same |form| for both credit card and address import/update. |
| 376 // - ImportCreditCard may update an existing card, or fill | 376 // - ImportCreditCard may update an existing card, or fill |
| 377 // |imported_credit_card| with an extracted card. See .h for details of | 377 // |imported_credit_card| with an extracted card. See .h for details of |
| 378 // |should_return_local_card|. | 378 // |should_return_local_card|. |
| 379 bool cc_import = | 379 bool cc_import = |
| 380 ImportCreditCard(form, should_return_local_card, imported_credit_card); | 380 ImportCreditCard(form, should_return_local_card, imported_credit_card); |
| 381 // - ImportAddressProfiles may eventually save or update one or more address | 381 // - ImportAddressProfiles may eventually save or update one or more address |
| 382 // profiles. | 382 // profiles. |
| 383 bool address_import = ImportAddressProfiles(form); | 383 bool address_import = ImportAddressProfiles(form); |
| 384 if (cc_import || address_import) | 384 if (cc_import || address_import) |
| (...skipping 995 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1380 if (!IsValidLearnableProfile(candidate_profile, app_locale_)) | 1380 if (!IsValidLearnableProfile(candidate_profile, app_locale_)) |
| 1381 return false; | 1381 return false; |
| 1382 | 1382 |
| 1383 SaveImportedProfile(candidate_profile); | 1383 SaveImportedProfile(candidate_profile); |
| 1384 return true; | 1384 return true; |
| 1385 } | 1385 } |
| 1386 | 1386 |
| 1387 bool PersonalDataManager::ImportCreditCard( | 1387 bool PersonalDataManager::ImportCreditCard( |
| 1388 const FormStructure& form, | 1388 const FormStructure& form, |
| 1389 bool should_return_local_card, | 1389 bool should_return_local_card, |
| 1390 scoped_ptr<CreditCard>* imported_credit_card) { | 1390 std::unique_ptr<CreditCard>* imported_credit_card) { |
| 1391 DCHECK(!imported_credit_card->get()); | 1391 DCHECK(!imported_credit_card->get()); |
| 1392 | 1392 |
| 1393 // The candidate for credit card import. There are many ways for the candidate | 1393 // The candidate for credit card import. There are many ways for the candidate |
| 1394 // to be rejected (see everywhere this function returns false, below). | 1394 // to be rejected (see everywhere this function returns false, below). |
| 1395 CreditCard candidate_credit_card; | 1395 CreditCard candidate_credit_card; |
| 1396 candidate_credit_card.set_origin(form.source_url().spec()); | 1396 candidate_credit_card.set_origin(form.source_url().spec()); |
| 1397 | 1397 |
| 1398 std::set<ServerFieldType> types_seen; | 1398 std::set<ServerFieldType> types_seen; |
| 1399 for (const AutofillField* field : form) { | 1399 for (const AutofillField* field : form) { |
| 1400 base::string16 value; | 1400 base::string16 value; |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1488 profiles_.insert(profiles_.end(), web_profiles().begin(), | 1488 profiles_.insert(profiles_.end(), web_profiles().begin(), |
| 1489 web_profiles().end()); | 1489 web_profiles().end()); |
| 1490 if (pref_service_->GetBoolean(prefs::kAutofillWalletImportEnabled)) { | 1490 if (pref_service_->GetBoolean(prefs::kAutofillWalletImportEnabled)) { |
| 1491 profiles_.insert( | 1491 profiles_.insert( |
| 1492 profiles_.end(), server_profiles_.begin(), server_profiles_.end()); | 1492 profiles_.end(), server_profiles_.begin(), server_profiles_.end()); |
| 1493 } | 1493 } |
| 1494 return profiles_; | 1494 return profiles_; |
| 1495 } | 1495 } |
| 1496 | 1496 |
| 1497 } // namespace autofill | 1497 } // namespace autofill |
| OLD | NEW |