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 #ifndef COMPONENTS_AUTOFILL_CORE_BROWSER_WEBDATA_AUTOFILL_TABLE_H_ | 5 #ifndef COMPONENTS_AUTOFILL_CORE_BROWSER_WEBDATA_AUTOFILL_TABLE_H_ |
6 #define COMPONENTS_AUTOFILL_CORE_BROWSER_WEBDATA_AUTOFILL_TABLE_H_ | 6 #define COMPONENTS_AUTOFILL_CORE_BROWSER_WEBDATA_AUTOFILL_TABLE_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 // Added in version 50. | 143 // Added in version 50. |
144 // billing_address_id The guid string that identifies the local profile which | 144 // billing_address_id The guid string that identifies the local profile which |
145 // is the billing address for this card. Can be null in the | 145 // is the billing address for this card. Can be null in the |
146 // database, but always returned as an empty string in | 146 // database, but always returned as an empty string in |
147 // CreditCard. Added in version 66. | 147 // CreditCard. Added in version 66. |
148 // | 148 // |
149 // masked_credit_cards | 149 // masked_credit_cards |
150 // This table contains "masked" credit card information | 150 // This table contains "masked" credit card information |
151 // about credit cards stored on the server. It consists | 151 // about credit cards stored on the server. It consists |
152 // of a short description and an ID, but not full payment | 152 // of a short description and an ID, but not full payment |
153 // information. Writing to this table is only done by sync. | 153 // information. Writing to this table is done by sync and |
| 154 // on successful save of card to the server. |
154 // When a server card is unmasked, it will stay here and | 155 // When a server card is unmasked, it will stay here and |
155 // will additionally be added in unmasked_credit_cards. | 156 // will additionally be added in unmasked_credit_cards. |
156 // | 157 // |
157 // id String assigned by the server to identify this card. | 158 // id String assigned by the server to identify this card. |
158 // This is opaque to the client. | 159 // This is opaque to the client. |
159 // status Server's status of this card. | 160 // status Server's status of this card. |
160 // TODO(brettw) define constants for this. | 161 // TODO(brettw) define constants for this. |
161 // name_on_card | 162 // name_on_card |
162 // type Type of the credit card. This is one of the | 163 // type Type of the credit card. This is one of the |
163 // kSyncCardType* strings. | 164 // kSyncCardType* strings. |
164 // last_four Last four digits of the card number. For de-duping | 165 // last_four Last four digits of the card number. For de-duping |
165 // with locally stored cards and generating descriptions. | 166 // with locally stored cards and generating descriptions. |
166 // exp_month Expiration month: 1-12 | 167 // exp_month Expiration month: 1-12 |
167 // exp_year Four-digit year: 2017 | 168 // exp_year Four-digit year: 2017 |
168 // | 169 // |
169 // unmasked_credit_cards | 170 // unmasked_credit_cards |
170 // When a masked credit credit card is unmasked and the | 171 // When a masked credit credit card is unmasked and the |
171 // full number is downloaded, it will be stored here. | 172 // full number is downloaded or when the full number is |
| 173 // available upon saving card to server, it will be stored |
| 174 // here. |
172 // | 175 // |
173 // id Server ID. This can be joined with the id in the | 176 // id Server ID. This can be joined with the id in the |
174 // masked_credit_cards table to get the rest of the data. | 177 // masked_credit_cards table to get the rest of the data. |
175 // card_number_encrypted | 178 // card_number_encrypted |
176 // Full card number, encrypted. | 179 // Full card number, encrypted. |
177 // use_count DEPRECATED in version 65. See server_card_metadata. | 180 // use_count DEPRECATED in version 65. See server_card_metadata. |
178 // use_date DEPRECATED in version 65. See server_card_metadata. | 181 // use_date DEPRECATED in version 65. See server_card_metadata. |
179 // TODO(crbug.com/682326): Remove deprecated columns. | 182 // TODO(crbug.com/682326): Remove deprecated columns. |
180 // unmask_date The date this card was unmasked in units of | 183 // unmask_date The date this card was unmasked in units of |
181 // Time::ToInternalValue. Added in version 64. | 184 // Time::ToInternalValue. Added in version 64. |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
351 // Records a single credit card in the credit_cards table. | 354 // Records a single credit card in the credit_cards table. |
352 bool AddCreditCard(const CreditCard& credit_card); | 355 bool AddCreditCard(const CreditCard& credit_card); |
353 | 356 |
354 // Updates the database values for the specified credit card. | 357 // Updates the database values for the specified credit card. |
355 bool UpdateCreditCard(const CreditCard& credit_card); | 358 bool UpdateCreditCard(const CreditCard& credit_card); |
356 | 359 |
357 // Removes a row from the credit_cards table. |guid| is the identifier of the | 360 // Removes a row from the credit_cards table. |guid| is the identifier of the |
358 // credit card to remove. | 361 // credit card to remove. |
359 bool RemoveCreditCard(const std::string& guid); | 362 bool RemoveCreditCard(const std::string& guid); |
360 | 363 |
| 364 // Adds to the masked_credit_cards and unmasked_credit_cards tables. |
| 365 bool AddFullServerCreditCard(const CreditCard& credit_card); |
| 366 |
361 // Retrieves a credit card with guid |guid|. | 367 // Retrieves a credit card with guid |guid|. |
362 std::unique_ptr<CreditCard> GetCreditCard(const std::string& guid); | 368 std::unique_ptr<CreditCard> GetCreditCard(const std::string& guid); |
363 | 369 |
364 // Retrieves the local/server credit cards in the database. | 370 // Retrieves the local/server credit cards in the database. |
365 virtual bool GetCreditCards( | 371 virtual bool GetCreditCards( |
366 std::vector<std::unique_ptr<CreditCard>>* credit_cards); | 372 std::vector<std::unique_ptr<CreditCard>>* credit_cards); |
367 virtual bool GetServerCreditCards( | 373 virtual bool GetServerCreditCards( |
368 std::vector<std::unique_ptr<CreditCard>>* credit_cards) const; | 374 std::vector<std::unique_ptr<CreditCard>>* credit_cards) const; |
369 | 375 |
370 // Replaces all server credit cards with the given vector. Unmasked cards | 376 // Replaces all server credit cards with the given vector. Unmasked cards |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
520 | 526 |
521 // Insert a single AutofillEntry into the autofill table. | 527 // Insert a single AutofillEntry into the autofill table. |
522 bool InsertAutofillEntry(const AutofillEntry& entry); | 528 bool InsertAutofillEntry(const AutofillEntry& entry); |
523 | 529 |
524 // Checks if the trash is empty. | 530 // Checks if the trash is empty. |
525 bool IsAutofillProfilesTrashEmpty(); | 531 bool IsAutofillProfilesTrashEmpty(); |
526 | 532 |
527 // Checks if the guid is in the trash. | 533 // Checks if the guid is in the trash. |
528 bool IsAutofillGUIDInTrash(const std::string& guid); | 534 bool IsAutofillGUIDInTrash(const std::string& guid); |
529 | 535 |
| 536 // Adds to |masked_credit_cards| and updates |server_card_metadata|. |
| 537 // Must already be in a transaction. |
| 538 void AddMaskedCreditCards(const std::vector<CreditCard>& credit_cards); |
| 539 |
| 540 // Adds to |unmasked_credit_cards|. |
| 541 void AddUnmaskedCreditCard(const std::string& id, |
| 542 const base::string16& full_number); |
| 543 |
| 544 // Deletes server credit cards by |id|. Returns true if a row was deleted. |
| 545 bool DeleteFromMaskedCreditCards(const std::string& id); |
| 546 bool DeleteFromUnmaskedCreditCards(const std::string& id); |
| 547 |
530 bool InitMainTable(); | 548 bool InitMainTable(); |
531 bool InitCreditCardsTable(); | 549 bool InitCreditCardsTable(); |
532 bool InitDatesTable(); | 550 bool InitDatesTable(); |
533 bool InitProfilesTable(); | 551 bool InitProfilesTable(); |
534 bool InitProfileNamesTable(); | 552 bool InitProfileNamesTable(); |
535 bool InitProfileEmailsTable(); | 553 bool InitProfileEmailsTable(); |
536 bool InitProfilePhonesTable(); | 554 bool InitProfilePhonesTable(); |
537 bool InitProfileTrashTable(); | 555 bool InitProfileTrashTable(); |
538 bool InitMaskedCreditCardsTable(); | 556 bool InitMaskedCreditCardsTable(); |
539 bool InitUnmaskedCreditCardsTable(); | 557 bool InitUnmaskedCreditCardsTable(); |
540 bool InitServerCardMetadataTable(); | 558 bool InitServerCardMetadataTable(); |
541 bool InitServerAddressesTable(); | 559 bool InitServerAddressesTable(); |
542 bool InitServerAddressMetadataTable(); | 560 bool InitServerAddressMetadataTable(); |
543 bool InitAutofillSyncMetadataTable(); | 561 bool InitAutofillSyncMetadataTable(); |
544 bool InitModelTypeStateTable(); | 562 bool InitModelTypeStateTable(); |
545 | 563 |
546 std::unique_ptr<AutofillTableEncryptor> autofill_table_encryptor_; | 564 std::unique_ptr<AutofillTableEncryptor> autofill_table_encryptor_; |
547 | 565 |
548 DISALLOW_COPY_AND_ASSIGN(AutofillTable); | 566 DISALLOW_COPY_AND_ASSIGN(AutofillTable); |
549 }; | 567 }; |
550 | 568 |
551 } // namespace autofill | 569 } // namespace autofill |
552 | 570 |
553 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_WEBDATA_AUTOFILL_TABLE_H_ | 571 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_WEBDATA_AUTOFILL_TABLE_H_ |
OLD | NEW |