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