OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 CHROME_BROWSER_WEBDATA_AUTOFILL_TABLE_H_ | 5 #ifndef CHROME_BROWSER_WEBDATA_AUTOFILL_TABLE_H_ |
6 #define CHROME_BROWSER_WEBDATA_AUTOFILL_TABLE_H_ | 6 #define CHROME_BROWSER_WEBDATA_AUTOFILL_TABLE_H_ |
7 | 7 |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "base/gtest_prod_util.h" | 9 #include "base/gtest_prod_util.h" |
10 #include "base/string16.h" | 10 #include "base/string16.h" |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 AutofillTable(); | 118 AutofillTable(); |
119 virtual ~AutofillTable(); | 119 virtual ~AutofillTable(); |
120 | 120 |
121 // Retrieves the AutofillTable* owned by |database|. | 121 // Retrieves the AutofillTable* owned by |database|. |
122 static AutofillTable* FromWebDatabase(WebDatabase* db); | 122 static AutofillTable* FromWebDatabase(WebDatabase* db); |
123 | 123 |
124 virtual WebDatabaseTable::TypeKey GetTypeKey() const OVERRIDE; | 124 virtual WebDatabaseTable::TypeKey GetTypeKey() const OVERRIDE; |
125 virtual bool Init(sql::Connection* db, sql::MetaTable* meta_table) OVERRIDE; | 125 virtual bool Init(sql::Connection* db, sql::MetaTable* meta_table) OVERRIDE; |
126 virtual bool IsSyncable() OVERRIDE; | 126 virtual bool IsSyncable() OVERRIDE; |
127 virtual bool MigrateToVersion(int version, | 127 virtual bool MigrateToVersion(int version, |
128 const std::string& app_locale, | |
129 bool* update_compatible_version) OVERRIDE; | 128 bool* update_compatible_version) OVERRIDE; |
130 | 129 |
131 // Records the form elements in |elements| in the database in the | 130 // Records the form elements in |elements| in the database in the |
132 // autofill table. A list of all added and updated autofill entries | 131 // autofill table. A list of all added and updated autofill entries |
133 // is returned in the changes out parameter. | 132 // is returned in the changes out parameter. |
134 bool AddFormFieldValues(const std::vector<FormFieldData>& elements, | 133 bool AddFormFieldValues(const std::vector<FormFieldData>& elements, |
135 std::vector<AutofillChange>* changes); | 134 std::vector<AutofillChange>* changes); |
136 | 135 |
137 // Records a single form element in the database in the autofill table. A list | 136 // Records a single form element in the database in the autofill table. A list |
138 // of all added and updated autofill entries is returned in the changes out | 137 // of all added and updated autofill entries is returned in the changes out |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
291 bool ClearAutofillProfiles(); | 290 bool ClearAutofillProfiles(); |
292 | 291 |
293 // Table migration functions. | 292 // Table migration functions. |
294 bool MigrateToVersion23AddCardNumberEncryptedColumn(); | 293 bool MigrateToVersion23AddCardNumberEncryptedColumn(); |
295 bool MigrateToVersion24CleanupOversizedStringFields(); | 294 bool MigrateToVersion24CleanupOversizedStringFields(); |
296 bool MigrateToVersion27UpdateLegacyCreditCards(); | 295 bool MigrateToVersion27UpdateLegacyCreditCards(); |
297 bool MigrateToVersion30AddDateModifed(); | 296 bool MigrateToVersion30AddDateModifed(); |
298 bool MigrateToVersion31AddGUIDToCreditCardsAndProfiles(); | 297 bool MigrateToVersion31AddGUIDToCreditCardsAndProfiles(); |
299 bool MigrateToVersion32UpdateProfilesAndCreditCards(); | 298 bool MigrateToVersion32UpdateProfilesAndCreditCards(); |
300 bool MigrateToVersion33ProfilesBasedOnFirstName(); | 299 bool MigrateToVersion33ProfilesBasedOnFirstName(); |
301 bool MigrateToVersion34ProfilesBasedOnCountryCode( | 300 bool MigrateToVersion34ProfilesBasedOnCountryCode(); |
302 const std::string& app_locale); | |
303 bool MigrateToVersion35GreatBritainCountryCodes(); | 301 bool MigrateToVersion35GreatBritainCountryCodes(); |
304 bool MigrateToVersion37MergeAndCullOlderProfiles(); | 302 bool MigrateToVersion37MergeAndCullOlderProfiles(); |
305 | 303 |
306 // Max data length saved in the table; | 304 // Max data length saved in the table; |
307 static const size_t kMaxDataLength; | 305 static const size_t kMaxDataLength; |
308 | 306 |
309 private: | 307 private: |
310 FRIEND_TEST_ALL_PREFIXES(AutofillTableTest, Autofill); | 308 FRIEND_TEST_ALL_PREFIXES(AutofillTableTest, Autofill); |
311 FRIEND_TEST_ALL_PREFIXES(AutofillTableTest, Autofill_AddChanges); | 309 FRIEND_TEST_ALL_PREFIXES(AutofillTableTest, Autofill_AddChanges); |
312 FRIEND_TEST_ALL_PREFIXES(AutofillTableTest, Autofill_RemoveBetweenChanges); | 310 FRIEND_TEST_ALL_PREFIXES(AutofillTableTest, Autofill_RemoveBetweenChanges); |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
349 | 347 |
350 bool InitMainTable(); | 348 bool InitMainTable(); |
351 bool InitCreditCardsTable(); | 349 bool InitCreditCardsTable(); |
352 bool InitDatesTable(); | 350 bool InitDatesTable(); |
353 bool InitProfilesTable(); | 351 bool InitProfilesTable(); |
354 bool InitProfileNamesTable(); | 352 bool InitProfileNamesTable(); |
355 bool InitProfileEmailsTable(); | 353 bool InitProfileEmailsTable(); |
356 bool InitProfilePhonesTable(); | 354 bool InitProfilePhonesTable(); |
357 bool InitProfileTrashTable(); | 355 bool InitProfileTrashTable(); |
358 | 356 |
| 357 // The application locale. The locale is needed for the migration to version |
| 358 // 35. Since it must be read on the UI thread, it is set when the table is |
| 359 // created (on the UI thread), and cached here so that it can be used for |
| 360 // migrations (on the DB thread). |
| 361 std::string app_locale_; |
| 362 |
359 DISALLOW_COPY_AND_ASSIGN(AutofillTable); | 363 DISALLOW_COPY_AND_ASSIGN(AutofillTable); |
360 }; | 364 }; |
361 | 365 |
362 #endif // CHROME_BROWSER_WEBDATA_AUTOFILL_TABLE_H_ | 366 #endif // CHROME_BROWSER_WEBDATA_AUTOFILL_TABLE_H_ |
OLD | NEW |