| 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 <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 // inner-city district or suburb. Added in version 54. | 61 // inner-city district or suburb. Added in version 54. |
| 62 // city | 62 // city |
| 63 // state | 63 // state |
| 64 // zipcode | 64 // zipcode |
| 65 // sorting_code Similar to the zipcode column, but used for businesses | 65 // sorting_code Similar to the zipcode column, but used for businesses |
| 66 // or organizations that might not be geographically | 66 // or organizations that might not be geographically |
| 67 // contiguous. The canonical example is CEDEX in France. | 67 // contiguous. The canonical example is CEDEX in France. |
| 68 // Added in version 54. | 68 // Added in version 54. |
| 69 // country_code | 69 // country_code |
| 70 // use_count The number of times this profile has been used to fill | 70 // use_count The number of times this profile has been used to fill |
| 71 // a form. | 71 // a form. Added in version 61. |
| 72 // last_use The date this profile was last used to fill a form. | 72 // use_date The date this profile was last used to fill a form, |
| 73 // date_modified The date on which this profile was last modified. | 73 // in time_t. Added in version 61. |
| 74 // Added in version 30. | 74 // date_modified The date on which this profile was last modified, in |
| 75 // time_t. Added in version 30. |
| 75 // origin The domain of origin for this profile. | 76 // origin The domain of origin for this profile. |
| 76 // Added in version 50. | 77 // Added in version 50. |
| 77 // language_code The BCP 47 language code used to format the address for | 78 // language_code The BCP 47 language code used to format the address for |
| 78 // display. For example, a JP address with "ja" language | 79 // display. For example, a JP address with "ja" language |
| 79 // code starts with the postal code, but a JP address with | 80 // code starts with the postal code, but a JP address with |
| 80 // "ja-latn" language code starts with the recipient name. | 81 // "ja-latn" language code starts with the recipient name. |
| 81 // Added in version 56. | 82 // Added in version 56. |
| 82 // | 83 // |
| 83 // autofill_profile_names | 84 // autofill_profile_names |
| 84 // This table contains the multi-valued name fields | 85 // This table contains the multi-valued name fields |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 // standard entries in a credit card form. | 120 // standard entries in a credit card form. |
| 120 // | 121 // |
| 121 // guid A guid string to uniquely identify the profile. | 122 // guid A guid string to uniquely identify the profile. |
| 122 // Added in version 31. | 123 // Added in version 31. |
| 123 // name_on_card | 124 // name_on_card |
| 124 // expiration_month | 125 // expiration_month |
| 125 // expiration_year | 126 // expiration_year |
| 126 // card_number_encrypted | 127 // card_number_encrypted |
| 127 // Stores encrypted credit card number. | 128 // Stores encrypted credit card number. |
| 128 // use_count The number of times this card has been used to fill | 129 // use_count The number of times this card has been used to fill |
| 129 // a form. | 130 // a form. Added in version 61. |
| 130 // last_use The date this card was last used to fill a form. | 131 // use_date The date this card was last used to fill a form, |
| 131 // date_modified The date on which this entry was last modified. | 132 // in time_t. Added in version 61. |
| 132 // Added in version 30. | 133 // date_modified The date on which this entry was last modified, in |
| 134 // time_t. Added in version 30. |
| 133 // origin The domain of origin for this profile. | 135 // origin The domain of origin for this profile. |
| 134 // Added in version 50. | 136 // Added in version 50. |
| 135 // | 137 // |
| 136 // masked_credit_cards | 138 // masked_credit_cards |
| 137 // This table contains "masked" credit card information | 139 // This table contains "masked" credit card information |
| 138 // about credit cards stored on the server. It consists | 140 // about credit cards stored on the server. It consists |
| 139 // of a short description and an ID, but not full payment | 141 // of a short description and an ID, but not full payment |
| 140 // information. Writing to this table is only done by sync. | 142 // information. Writing to this table is only done by sync. |
| 141 // When a server card is unmasked, it will stay here and | 143 // When a server card is unmasked, it will stay here and |
| 142 // will additionally be added in unmasked_credit_cards. | 144 // will additionally be added in unmasked_credit_cards. |
| (...skipping 11 matching lines...) Expand all Loading... |
| 154 // exp_year Four-digit year: 2017 | 156 // exp_year Four-digit year: 2017 |
| 155 // | 157 // |
| 156 // unmasked_credit_cards | 158 // unmasked_credit_cards |
| 157 // When a masked credit credit card is unmasked and the | 159 // When a masked credit credit card is unmasked and the |
| 158 // full number is downloaded, it will be stored here. | 160 // full number is downloaded, it will be stored here. |
| 159 // | 161 // |
| 160 // id Server ID. This can be joined with the id in the | 162 // id Server ID. This can be joined with the id in the |
| 161 // masked_credit_cards table to get the rest of the data. | 163 // masked_credit_cards table to get the rest of the data. |
| 162 // card_number_encrypted | 164 // card_number_encrypted |
| 163 // Full card number, encrypted. | 165 // Full card number, encrypted. |
| 166 // use_count The number of times this card has been used to fill |
| 167 // a form. Added in version 62. |
| 168 // use_date The date this card was last used to fill a form, in |
| 169 // internal time format (NOT time_t). Added in version 62. |
| 164 // | 170 // |
| 165 // server_addresses This table contains Autofill address data synced from | 171 // server_addresses This table contains Autofill address data synced from |
| 166 // the wallet server. It's basically the same as the | 172 // the wallet server. It's basically the same as the |
| 167 // autofill_profiles table but locally immutable. | 173 // autofill_profiles table but locally immutable. |
| 168 // | 174 // |
| 169 // id String assigned by the server to identify this address. | 175 // id String assigned by the server to identify this address. |
| 170 // This is opaque to the client. | 176 // This is opaque to the client. |
| 171 // company_name | 177 // company_name |
| 172 // street_address The combined lines of the street address. | 178 // street_address The combined lines of the street address. |
| 173 // address_1 Also known as "administrative area". This is normally | 179 // address_1 Also known as "administrative area". This is normally |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 304 // present in the new list will be preserved (even if the input is MASKED). | 310 // present in the new list will be preserved (even if the input is MASKED). |
| 305 void SetServerCreditCards(const std::vector<CreditCard>& credit_cards); | 311 void SetServerCreditCards(const std::vector<CreditCard>& credit_cards); |
| 306 | 312 |
| 307 // Cards synced from the server may be "masked" (only last 4 digits | 313 // Cards synced from the server may be "masked" (only last 4 digits |
| 308 // available) or "unmasked" (everything is available). These functions set | 314 // available) or "unmasked" (everything is available). These functions set |
| 309 // that state. | 315 // that state. |
| 310 bool UnmaskServerCreditCard(const std::string& id, | 316 bool UnmaskServerCreditCard(const std::string& id, |
| 311 const base::string16& full_number); | 317 const base::string16& full_number); |
| 312 bool MaskServerCreditCard(const std::string& id); | 318 bool MaskServerCreditCard(const std::string& id); |
| 313 | 319 |
| 320 // Updates the use count and last use date for an unmasked server card. |
| 321 bool UpdateUnmaskedCardUsageStats(const CreditCard& credit_card); |
| 322 |
| 314 // Removes rows from autofill_profiles and credit_cards if they were created | 323 // Removes rows from autofill_profiles and credit_cards if they were created |
| 315 // on or after |delete_begin| and strictly before |delete_end|. Returns the | 324 // on or after |delete_begin| and strictly before |delete_end|. Returns the |
| 316 // list of deleted profile guids in |profile_guids|. Return value is true if | 325 // list of deleted profile guids in |profile_guids|. Return value is true if |
| 317 // all rows were successfully removed. Returns false on database error. In | 326 // all rows were successfully removed. Returns false on database error. In |
| 318 // that case, the output vector state is undefined, and may be partially | 327 // that case, the output vector state is undefined, and may be partially |
| 319 // filled. | 328 // filled. |
| 320 bool RemoveAutofillDataModifiedBetween( | 329 bool RemoveAutofillDataModifiedBetween( |
| 321 const base::Time& delete_begin, | 330 const base::Time& delete_begin, |
| 322 const base::Time& delete_end, | 331 const base::Time& delete_end, |
| 323 std::vector<std::string>* profile_guids, | 332 std::vector<std::string>* profile_guids, |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 362 bool MigrateToVersion34ProfilesBasedOnCountryCode(); | 371 bool MigrateToVersion34ProfilesBasedOnCountryCode(); |
| 363 bool MigrateToVersion35GreatBritainCountryCodes(); | 372 bool MigrateToVersion35GreatBritainCountryCodes(); |
| 364 bool MigrateToVersion37MergeAndCullOlderProfiles(); | 373 bool MigrateToVersion37MergeAndCullOlderProfiles(); |
| 365 bool MigrateToVersion51AddOriginColumn(); | 374 bool MigrateToVersion51AddOriginColumn(); |
| 366 bool MigrateToVersion54AddI18nFieldsAndRemoveDeprecatedFields(); | 375 bool MigrateToVersion54AddI18nFieldsAndRemoveDeprecatedFields(); |
| 367 bool MigrateToVersion55MergeAutofillDatesTable(); | 376 bool MigrateToVersion55MergeAutofillDatesTable(); |
| 368 bool MigrateToVersion56AddProfileLanguageCodeForFormatting(); | 377 bool MigrateToVersion56AddProfileLanguageCodeForFormatting(); |
| 369 bool MigrateToVersion57AddFullNameField(); | 378 bool MigrateToVersion57AddFullNameField(); |
| 370 bool MigrateToVersion60AddServerCards(); | 379 bool MigrateToVersion60AddServerCards(); |
| 371 bool MigrateToVersion61AddUsageStats(); | 380 bool MigrateToVersion61AddUsageStats(); |
| 381 bool MigrateToVersion62AddUsageStatsForUnmaskedCards(); |
| 372 | 382 |
| 373 // Max data length saved in the table; | 383 // Max data length saved in the table; |
| 374 static const size_t kMaxDataLength; | 384 static const size_t kMaxDataLength; |
| 375 | 385 |
| 376 private: | 386 private: |
| 377 FRIEND_TEST_ALL_PREFIXES(AutofillTableTest, Autofill); | 387 FRIEND_TEST_ALL_PREFIXES(AutofillTableTest, Autofill); |
| 378 FRIEND_TEST_ALL_PREFIXES(AutofillTableTest, Autofill_AddChanges); | 388 FRIEND_TEST_ALL_PREFIXES(AutofillTableTest, Autofill_AddChanges); |
| 379 FRIEND_TEST_ALL_PREFIXES(AutofillTableTest, Autofill_RemoveBetweenChanges); | 389 FRIEND_TEST_ALL_PREFIXES(AutofillTableTest, Autofill_RemoveBetweenChanges); |
| 380 FRIEND_TEST_ALL_PREFIXES(AutofillTableTest, Autofill_UpdateDontReplace); | 390 FRIEND_TEST_ALL_PREFIXES(AutofillTableTest, Autofill_UpdateDontReplace); |
| 381 FRIEND_TEST_ALL_PREFIXES( | 391 FRIEND_TEST_ALL_PREFIXES( |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 445 // created (on the UI thread), and cached here so that it can be used for | 455 // created (on the UI thread), and cached here so that it can be used for |
| 446 // migrations (on the DB thread). | 456 // migrations (on the DB thread). |
| 447 std::string app_locale_; | 457 std::string app_locale_; |
| 448 | 458 |
| 449 DISALLOW_COPY_AND_ASSIGN(AutofillTable); | 459 DISALLOW_COPY_AND_ASSIGN(AutofillTable); |
| 450 }; | 460 }; |
| 451 | 461 |
| 452 } // namespace autofill | 462 } // namespace autofill |
| 453 | 463 |
| 454 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_WEBDATA_AUTOFILL_TABLE_H_ | 464 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_WEBDATA_AUTOFILL_TABLE_H_ |
| OLD | NEW |