| 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/webdata/autofill_table.h" | 5 #include "components/autofill/core/browser/webdata/autofill_table.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <cmath> | 10 #include <cmath> |
| (...skipping 1306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1317 masked_insert.BindString(2, | 1317 masked_insert.BindString(2, |
| 1318 ServerStatusEnumToString(card.GetServerStatus())); | 1318 ServerStatusEnumToString(card.GetServerStatus())); |
| 1319 masked_insert.BindString16(3, card.GetRawInfo(CREDIT_CARD_NAME_FULL)); | 1319 masked_insert.BindString16(3, card.GetRawInfo(CREDIT_CARD_NAME_FULL)); |
| 1320 masked_insert.BindString16(4, card.LastFourDigits()); | 1320 masked_insert.BindString16(4, card.LastFourDigits()); |
| 1321 masked_insert.BindString16(5, card.GetRawInfo(CREDIT_CARD_EXP_MONTH)); | 1321 masked_insert.BindString16(5, card.GetRawInfo(CREDIT_CARD_EXP_MONTH)); |
| 1322 masked_insert.BindString16(6, | 1322 masked_insert.BindString16(6, |
| 1323 card.GetRawInfo(CREDIT_CARD_EXP_4_DIGIT_YEAR)); | 1323 card.GetRawInfo(CREDIT_CARD_EXP_4_DIGIT_YEAR)); |
| 1324 | 1324 |
| 1325 masked_insert.Run(); | 1325 masked_insert.Run(); |
| 1326 masked_insert.Reset(true); | 1326 masked_insert.Reset(true); |
| 1327 |
| 1328 // Save the use count and use date of the card. |
| 1329 UpdateServerCardMetadata(card); |
| 1327 } | 1330 } |
| 1328 | 1331 |
| 1329 // Delete all items in the unmasked table that aren't in the new set. | 1332 // Delete all items in the unmasked table that aren't in the new set. |
| 1330 sql::Statement unmasked_delete(db_->GetUniqueStatement( | 1333 sql::Statement unmasked_delete(db_->GetUniqueStatement( |
| 1331 "DELETE FROM unmasked_credit_cards WHERE id NOT IN " | 1334 "DELETE FROM unmasked_credit_cards WHERE id NOT IN " |
| 1332 "(SELECT id FROM masked_credit_cards)")); | 1335 "(SELECT id FROM masked_credit_cards)")); |
| 1333 unmasked_delete.Run(); | 1336 unmasked_delete.Run(); |
| 1334 // Do the same for metadata. | 1337 // Do the same for metadata. |
| 1335 sql::Statement metadata_delete(db_->GetUniqueStatement( | 1338 sql::Statement metadata_delete(db_->GetUniqueStatement( |
| 1336 "DELETE FROM server_card_metadata WHERE id NOT IN " | 1339 "DELETE FROM server_card_metadata WHERE id NOT IN " |
| (...skipping 1198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2535 if (!db_->Execute("DROP TABLE masked_credit_cards") || | 2538 if (!db_->Execute("DROP TABLE masked_credit_cards") || |
| 2536 !db_->Execute("ALTER TABLE masked_credit_cards_temp " | 2539 !db_->Execute("ALTER TABLE masked_credit_cards_temp " |
| 2537 "RENAME TO masked_credit_cards")) { | 2540 "RENAME TO masked_credit_cards")) { |
| 2538 return false; | 2541 return false; |
| 2539 } | 2542 } |
| 2540 | 2543 |
| 2541 return transaction.Commit(); | 2544 return transaction.Commit(); |
| 2542 } | 2545 } |
| 2543 | 2546 |
| 2544 } // namespace autofill | 2547 } // namespace autofill |
| OLD | NEW |