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 463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
474 FOR_EACH_OBSERVER(PersonalDataManagerObserver, observers_, | 474 FOR_EACH_OBSERVER(PersonalDataManagerObserver, observers_, |
475 OnInsufficientFormData()); | 475 OnInsufficientFormData()); |
476 return false; | 476 return false; |
477 } | 477 } |
478 | 478 |
479 void PersonalDataManager::RecordUseOf(const AutofillDataModel& data_model) { | 479 void PersonalDataManager::RecordUseOf(const AutofillDataModel& data_model) { |
480 if (!database_.get()) | 480 if (!database_.get()) |
481 return; | 481 return; |
482 | 482 |
483 CreditCard* credit_card = GetCreditCardByGUID(data_model.guid()); | 483 CreditCard* credit_card = GetCreditCardByGUID(data_model.guid()); |
484 if (credit_card && credit_card->record_type() == CreditCard::LOCAL_CARD) { | 484 if (credit_card) { |
485 credit_card->RecordUse(); | 485 credit_card->RecordUse(); |
486 database_->UpdateCreditCard(*credit_card); | 486 |
| 487 if (credit_card->record_type() == CreditCard::LOCAL_CARD) |
| 488 database_->UpdateCreditCard(*credit_card); |
| 489 else if (credit_card->record_type() == CreditCard::FULL_SERVER_CARD) |
| 490 database_->UpdateUnmaskedCardUsageStats(*credit_card); |
| 491 else |
| 492 NOTREACHED() << " A MASKED_SERVER_CARD can't be used."; |
| 493 |
487 Refresh(); | 494 Refresh(); |
488 return; | 495 return; |
489 } | 496 } |
490 | 497 |
491 AutofillProfile* profile = GetProfileByGUID(data_model.guid()); | 498 AutofillProfile* profile = GetProfileByGUID(data_model.guid()); |
492 if (profile) { | 499 if (profile) { |
493 profile->RecordUse(); | 500 profile->RecordUse(); |
494 database_->UpdateAutofillProfile(*profile); | 501 database_->UpdateAutofillProfile(*profile); |
495 Refresh(); | 502 Refresh(); |
496 } | 503 } |
(...skipping 758 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1255 } | 1262 } |
1256 if (IsExperimentalWalletIntegrationEnabled() && | 1263 if (IsExperimentalWalletIntegrationEnabled() && |
1257 pref_service_->GetBoolean(prefs::kAutofillWalletImportEnabled)) { | 1264 pref_service_->GetBoolean(prefs::kAutofillWalletImportEnabled)) { |
1258 profiles_.insert( | 1265 profiles_.insert( |
1259 profiles_.end(), server_profiles_.begin(), server_profiles_.end()); | 1266 profiles_.end(), server_profiles_.begin(), server_profiles_.end()); |
1260 } | 1267 } |
1261 return profiles_; | 1268 return profiles_; |
1262 } | 1269 } |
1263 | 1270 |
1264 } // namespace autofill | 1271 } // namespace autofill |
OLD | NEW |