| 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 <algorithm> | 7 #include <algorithm> |
| 8 #include <functional> | 8 #include <functional> |
| 9 #include <iterator> | 9 #include <iterator> |
| 10 | 10 |
| (...skipping 493 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 504 } | 504 } |
| 505 | 505 |
| 506 void PersonalDataManager::RecordUseOf(const AutofillDataModel& data_model) { | 506 void PersonalDataManager::RecordUseOf(const AutofillDataModel& data_model) { |
| 507 if (!database_.get()) | 507 if (!database_.get()) |
| 508 return; | 508 return; |
| 509 | 509 |
| 510 CreditCard* credit_card = GetCreditCardByGUID(data_model.guid()); | 510 CreditCard* credit_card = GetCreditCardByGUID(data_model.guid()); |
| 511 if (credit_card) { | 511 if (credit_card) { |
| 512 credit_card->RecordUse(); | 512 credit_card->RecordUse(); |
| 513 | 513 |
| 514 if (credit_card->record_type() == CreditCard::LOCAL_CARD) | 514 if (credit_card->record_type() == CreditCard::LOCAL_CARD) { |
| 515 database_->UpdateCreditCard(*credit_card); | 515 database_->UpdateCreditCard(*credit_card); |
| 516 else if (credit_card->record_type() == CreditCard::FULL_SERVER_CARD) | 516 } else if (credit_card->record_type() == CreditCard::FULL_SERVER_CARD) { |
| 517 database_->UpdateUnmaskedCardUsageStats(*credit_card); | 517 database_->UpdateUnmaskedCardUsageStats(*credit_card); |
| 518 else | 518 } else { |
| 519 NOTREACHED() << " A MASKED_SERVER_CARD can't be used."; | 519 // It's possible to get a masked server card here if the user decides not |
| 520 // to store a card while verifying it. We don't currently track usage |
| 521 // of masked cards, so no-op. |
| 522 return; |
| 523 } |
| 520 | 524 |
| 521 Refresh(); | 525 Refresh(); |
| 522 return; | 526 return; |
| 523 } | 527 } |
| 524 | 528 |
| 525 AutofillProfile* profile = GetProfileByGUID(data_model.guid()); | 529 AutofillProfile* profile = GetProfileByGUID(data_model.guid()); |
| 526 if (profile) { | 530 if (profile) { |
| 527 profile->RecordUse(); | 531 profile->RecordUse(); |
| 528 database_->UpdateAutofillProfile(*profile); | 532 database_->UpdateAutofillProfile(*profile); |
| 529 Refresh(); | 533 Refresh(); |
| (...skipping 832 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1362 } | 1366 } |
| 1363 if (IsExperimentalWalletIntegrationEnabled() && | 1367 if (IsExperimentalWalletIntegrationEnabled() && |
| 1364 pref_service_->GetBoolean(prefs::kAutofillWalletImportEnabled)) { | 1368 pref_service_->GetBoolean(prefs::kAutofillWalletImportEnabled)) { |
| 1365 profiles_.insert( | 1369 profiles_.insert( |
| 1366 profiles_.end(), server_profiles_.begin(), server_profiles_.end()); | 1370 profiles_.end(), server_profiles_.begin(), server_profiles_.end()); |
| 1367 } | 1371 } |
| 1368 return profiles_; | 1372 return profiles_; |
| 1369 } | 1373 } |
| 1370 | 1374 |
| 1371 } // namespace autofill | 1375 } // namespace autofill |
| OLD | NEW |