| 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 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 // This is opaque to the client. | 160 // This is opaque to the client. |
| 161 // status Server's status of this card. | 161 // status Server's status of this card. |
| 162 // TODO(brettw) define constants for this. | 162 // TODO(brettw) define constants for this. |
| 163 // name_on_card | 163 // name_on_card |
| 164 // type Type of the credit card. This is one of the | 164 // type Type of the credit card. This is one of the |
| 165 // kSyncCardType* strings. | 165 // kSyncCardType* strings. |
| 166 // last_four Last four digits of the card number. For de-duping | 166 // last_four Last four digits of the card number. For de-duping |
| 167 // with locally stored cards and generating descriptions. | 167 // with locally stored cards and generating descriptions. |
| 168 // exp_month Expiration month: 1-12 | 168 // exp_month Expiration month: 1-12 |
| 169 // exp_year Four-digit year: 2017 | 169 // exp_year Four-digit year: 2017 |
| 170 // billing_address_id The string that identifies the local or server profile | |
| 171 // which is the billing address for this card. Can be null | |
| 172 // in the database, but always returned as an empty string | |
| 173 // in CreditCard. Added in version 67. | |
| 174 // | 170 // |
| 175 // unmasked_credit_cards | 171 // unmasked_credit_cards |
| 176 // When a masked credit credit card is unmasked and the | 172 // When a masked credit credit card is unmasked and the |
| 177 // full number is downloaded, it will be stored here. | 173 // full number is downloaded, it will be stored here. |
| 178 // | 174 // |
| 179 // 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 |
| 180 // masked_credit_cards table to get the rest of the data. | 176 // masked_credit_cards table to get the rest of the data. |
| 181 // card_number_encrypted | 177 // card_number_encrypted |
| 182 // Full card number, encrypted. | 178 // Full card number, encrypted. |
| 183 // use_count DEPRECATED in version 65. See server_card_metadata. | 179 // use_count DEPRECATED in version 65. See server_card_metadata. |
| 184 // use_date DEPRECATED in version 65. See server_card_metadata. | 180 // use_date DEPRECATED in version 65. See server_card_metadata. |
| 181 // TODO(crbug.com/682326): Remove deprecated columns. |
| 185 // unmask_date The date this card was unmasked in units of | 182 // unmask_date The date this card was unmasked in units of |
| 186 // Time::ToInternalValue. Added in version 64. | 183 // Time::ToInternalValue. Added in version 64. |
| 187 // | 184 // |
| 188 // server_card_metadata | 185 // server_card_metadata |
| 189 // Metadata (currently, usage data) about server credit | 186 // Metadata (currently, usage data) about server credit |
| 190 // cards. This will be synced. | 187 // cards. This will be synced. |
| 191 // | 188 // |
| 192 // id The server ID, which matches an ID from the | 189 // id The server ID, which matches an ID from the |
| 193 // masked_credit_cards table. | 190 // masked_credit_cards table. |
| 194 // use_count The number of times this card has been used to fill | 191 // use_count The number of times this card has been used to fill |
| 195 // a form. | 192 // a form. |
| 196 // use_date The date this card was last used to fill a form, | 193 // use_date The date this card was last used to fill a form, |
| 197 // in internal t. | 194 // in internal t. |
| 195 // billing_address_id The string that identifies the profile which is the |
| 196 // billing address for this card. Can be null in the |
| 197 // database, but always returned as an empty string in |
| 198 // CreditCard. Added in version 71. |
| 198 // | 199 // |
| 199 // server_addresses This table contains Autofill address data synced from | 200 // server_addresses This table contains Autofill address data synced from |
| 200 // the wallet server. It's basically the same as the | 201 // the wallet server. It's basically the same as the |
| 201 // autofill_profiles table but locally immutable. | 202 // autofill_profiles table but locally immutable. |
| 202 // | 203 // |
| 203 // id String assigned by the server to identify this address. | 204 // id String assigned by the server to identify this address. |
| 204 // This is opaque to the client. | 205 // This is opaque to the client. |
| 205 // recipient_name Added in v63. | 206 // recipient_name Added in v63. |
| 206 // company_name | 207 // company_name |
| 207 // street_address The combined lines of the street address. | 208 // street_address The combined lines of the street address. |
| (...skipping 20 matching lines...) Expand all Loading... |
| 228 // server_address_metadata | 229 // server_address_metadata |
| 229 // Metadata (currently, usage data) about server addresses. | 230 // Metadata (currently, usage data) about server addresses. |
| 230 // This will be synced. | 231 // This will be synced. |
| 231 // | 232 // |
| 232 // id The server ID, which matches an ID from the | 233 // id The server ID, which matches an ID from the |
| 233 // server_addresses table. | 234 // server_addresses table. |
| 234 // use_count The number of times this address has been used to fill | 235 // use_count The number of times this address has been used to fill |
| 235 // a form. | 236 // a form. |
| 236 // use_date The date this address was last used to fill a form, | 237 // use_date The date this address was last used to fill a form, |
| 237 // in internal t. | 238 // in internal t. |
| 239 // has_converted Whether this server address has been converted to a |
| 240 // local autofill profile. |
| 241 // |
| 238 // autofill_sync_metadata | 242 // autofill_sync_metadata |
| 239 // Sync-specific metadata for autofill records. | 243 // Sync-specific metadata for autofill records. |
| 240 // | 244 // |
| 241 // storage_key A string that uniquely identifies the metadata record | 245 // storage_key A string that uniquely identifies the metadata record |
| 242 // as well as the corresponding autofill record. | 246 // as well as the corresponding autofill record. |
| 243 // value The serialized EntityMetadata record. | 247 // value The serialized EntityMetadata record. |
| 244 // | 248 // |
| 245 // autofill_model_type_state | 249 // autofill_model_type_state |
| 246 // Single row table that contains the sync ModelTypeState | 250 // Single row table that contains the sync ModelTypeState |
| 247 // for the autofill model type. | 251 // for the autofill model type. |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 368 // present in the new list will be preserved (even if the input is MASKED). | 372 // present in the new list will be preserved (even if the input is MASKED). |
| 369 void SetServerCreditCards(const std::vector<CreditCard>& credit_cards); | 373 void SetServerCreditCards(const std::vector<CreditCard>& credit_cards); |
| 370 | 374 |
| 371 // Cards synced from the server may be "masked" (only last 4 digits | 375 // Cards synced from the server may be "masked" (only last 4 digits |
| 372 // available) or "unmasked" (everything is available). These functions set | 376 // available) or "unmasked" (everything is available). These functions set |
| 373 // that state. | 377 // that state. |
| 374 bool UnmaskServerCreditCard(const CreditCard& masked, | 378 bool UnmaskServerCreditCard(const CreditCard& masked, |
| 375 const base::string16& full_number); | 379 const base::string16& full_number); |
| 376 bool MaskServerCreditCard(const std::string& id); | 380 bool MaskServerCreditCard(const std::string& id); |
| 377 | 381 |
| 378 bool UpdateServerCardUsageStats(const CreditCard& credit_card); | 382 bool UpdateServerCardMetadata(const CreditCard& credit_card); |
| 379 bool UpdateServerAddressUsageStats(const AutofillProfile& profile); | 383 bool UpdateServerAddressMetadata(const AutofillProfile& profile); |
| 380 | |
| 381 bool UpdateServerCardBillingAddress(const CreditCard& credit_card); | |
| 382 | 384 |
| 383 // Deletes all data from the server card and profile tables. Returns true if | 385 // Deletes all data from the server card and profile tables. Returns true if |
| 384 // any data was deleted, false if not (so false means "commit not needed" | 386 // any data was deleted, false if not (so false means "commit not needed" |
| 385 // rather than "error"). | 387 // rather than "error"). |
| 386 bool ClearAllServerData(); | 388 bool ClearAllServerData(); |
| 387 | 389 |
| 388 // Removes rows from autofill_profiles and credit_cards if they were created | 390 // Removes rows from autofill_profiles and credit_cards if they were created |
| 389 // on or after |delete_begin| and strictly before |delete_end|. Returns the | 391 // on or after |delete_begin| and strictly before |delete_end|. Returns the |
| 390 // list of deleted profile guids in |profile_guids|. Return value is true if | 392 // list of deleted profile guids in |profile_guids|. Return value is true if |
| 391 // all rows were successfully removed. Returns false on database error. In | 393 // all rows were successfully removed. Returns false on database error. In |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 454 bool MigrateToVersion57AddFullNameField(); | 456 bool MigrateToVersion57AddFullNameField(); |
| 455 bool MigrateToVersion60AddServerCards(); | 457 bool MigrateToVersion60AddServerCards(); |
| 456 bool MigrateToVersion61AddUsageStats(); | 458 bool MigrateToVersion61AddUsageStats(); |
| 457 bool MigrateToVersion62AddUsageStatsForUnmaskedCards(); | 459 bool MigrateToVersion62AddUsageStatsForUnmaskedCards(); |
| 458 bool MigrateToVersion63AddServerRecipientName(); | 460 bool MigrateToVersion63AddServerRecipientName(); |
| 459 bool MigrateToVersion64AddUnmaskDate(); | 461 bool MigrateToVersion64AddUnmaskDate(); |
| 460 bool MigrateToVersion65AddServerMetadataTables(); | 462 bool MigrateToVersion65AddServerMetadataTables(); |
| 461 bool MigrateToVersion66AddCardBillingAddress(); | 463 bool MigrateToVersion66AddCardBillingAddress(); |
| 462 bool MigrateToVersion67AddMaskedCardBillingAddress(); | 464 bool MigrateToVersion67AddMaskedCardBillingAddress(); |
| 463 bool MigrateToVersion70AddSyncMetadata(); | 465 bool MigrateToVersion70AddSyncMetadata(); |
| 466 bool MigrateToVersion71AddHasConvertedAndBillingAddressIdMetadata(); |
| 464 | 467 |
| 465 // Max data length saved in the table, AKA the maximum length allowed for | 468 // Max data length saved in the table, AKA the maximum length allowed for |
| 466 // form data. | 469 // form data. |
| 467 // Copied to components/autofill/ios/browser/resources/autofill_controller.js. | 470 // Copied to components/autofill/ios/browser/resources/autofill_controller.js. |
| 468 static const size_t kMaxDataLength; | 471 static const size_t kMaxDataLength; |
| 469 | 472 |
| 470 private: | 473 private: |
| 471 FRIEND_TEST_ALL_PREFIXES(AutofillTableTest, Autofill); | 474 FRIEND_TEST_ALL_PREFIXES(AutofillTableTest, Autofill); |
| 472 FRIEND_TEST_ALL_PREFIXES(AutofillTableTest, Autofill_AddChanges); | 475 FRIEND_TEST_ALL_PREFIXES(AutofillTableTest, Autofill_AddChanges); |
| 473 FRIEND_TEST_ALL_PREFIXES( | 476 FRIEND_TEST_ALL_PREFIXES( |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 546 bool InitServerAddressMetadataTable(); | 549 bool InitServerAddressMetadataTable(); |
| 547 bool InitAutofillSyncMetadataTable(); | 550 bool InitAutofillSyncMetadataTable(); |
| 548 bool InitModelTypeStateTable(); | 551 bool InitModelTypeStateTable(); |
| 549 | 552 |
| 550 DISALLOW_COPY_AND_ASSIGN(AutofillTable); | 553 DISALLOW_COPY_AND_ASSIGN(AutofillTable); |
| 551 }; | 554 }; |
| 552 | 555 |
| 553 } // namespace autofill | 556 } // namespace autofill |
| 554 | 557 |
| 555 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_WEBDATA_AUTOFILL_TABLE_H_ | 558 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_WEBDATA_AUTOFILL_TABLE_H_ |
| OLD | NEW |