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

Side by Side Diff: components/autofill/core/browser/webdata/autofill_table.cc

Issue 2719723002: [Autofill] Split server card data and metadata updates. (Closed)
Patch Set: Addressed comments Created 3 years, 9 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
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/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
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);
1330 } 1327 }
1331 1328
1332 // Delete all items in the unmasked table that aren't in the new set. 1329 // Delete all items in the unmasked table that aren't in the new set.
1333 sql::Statement unmasked_delete(db_->GetUniqueStatement( 1330 sql::Statement unmasked_delete(db_->GetUniqueStatement(
1334 "DELETE FROM unmasked_credit_cards WHERE id NOT IN " 1331 "DELETE FROM unmasked_credit_cards WHERE id NOT IN "
1335 "(SELECT id FROM masked_credit_cards)")); 1332 "(SELECT id FROM masked_credit_cards)"));
1336 unmasked_delete.Run(); 1333 unmasked_delete.Run();
1337 // Do the same for metadata. 1334 // Do the same for metadata.
1338 sql::Statement metadata_delete(db_->GetUniqueStatement( 1335 sql::Statement metadata_delete(db_->GetUniqueStatement(
1339 "DELETE FROM server_card_metadata WHERE id NOT IN " 1336 "DELETE FROM server_card_metadata WHERE id NOT IN "
(...skipping 1198 matching lines...) Expand 10 before | Expand all | Expand 10 after
2538 if (!db_->Execute("DROP TABLE masked_credit_cards") || 2535 if (!db_->Execute("DROP TABLE masked_credit_cards") ||
2539 !db_->Execute("ALTER TABLE masked_credit_cards_temp " 2536 !db_->Execute("ALTER TABLE masked_credit_cards_temp "
2540 "RENAME TO masked_credit_cards")) { 2537 "RENAME TO masked_credit_cards")) {
2541 return false; 2538 return false;
2542 } 2539 }
2543 2540
2544 return transaction.Commit(); 2541 return transaction.Commit();
2545 } 2542 }
2546 2543
2547 } // namespace autofill 2544 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698