| 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 #include "chrome/browser/webdata/autofill_table.h" | 5 #include "chrome/browser/webdata/autofill_table.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <limits> | 8 #include <limits> |
| 9 #include <map> | 9 #include <map> |
| 10 #include <set> | 10 #include <set> |
| (...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 335 return (InitMainTable() && InitCreditCardsTable() && InitDatesTable() && | 335 return (InitMainTable() && InitCreditCardsTable() && InitDatesTable() && |
| 336 InitProfilesTable() && InitProfileNamesTable() && | 336 InitProfilesTable() && InitProfileNamesTable() && |
| 337 InitProfileEmailsTable() && InitProfilePhonesTable() && | 337 InitProfileEmailsTable() && InitProfilePhonesTable() && |
| 338 InitProfileTrashTable()); | 338 InitProfileTrashTable()); |
| 339 } | 339 } |
| 340 | 340 |
| 341 bool AutofillTable::IsSyncable() { | 341 bool AutofillTable::IsSyncable() { |
| 342 return true; | 342 return true; |
| 343 } | 343 } |
| 344 | 344 |
| 345 bool AutofillTable::MigrateToVersion(int version, |
| 346 const std::string& app_locale, |
| 347 bool* update_compatible_version) { |
| 348 // Migrate if necessary. |
| 349 switch (version) { |
| 350 case 22: |
| 351 return ClearAutofillEmptyValueElements(); |
| 352 case 23: |
| 353 return MigrateToVersion23AddCardNumberEncryptedColumn(); |
| 354 case 24: |
| 355 return MigrateToVersion24CleanupOversizedStringFields(); |
| 356 case 27: |
| 357 *update_compatible_version = true; |
| 358 return MigrateToVersion27UpdateLegacyCreditCards(); |
| 359 case 30: |
| 360 *update_compatible_version = true; |
| 361 return MigrateToVersion30AddDateModifed(); |
| 362 case 31: |
| 363 *update_compatible_version = true; |
| 364 return MigrateToVersion31AddGUIDToCreditCardsAndProfiles(); |
| 365 case 32: |
| 366 *update_compatible_version = true; |
| 367 return MigrateToVersion32UpdateProfilesAndCreditCards(); |
| 368 case 33: |
| 369 *update_compatible_version = true; |
| 370 return MigrateToVersion33ProfilesBasedOnFirstName(); |
| 371 case 34: |
| 372 *update_compatible_version = true; |
| 373 return MigrateToVersion34ProfilesBasedOnCountryCode(app_locale); |
| 374 case 35: |
| 375 *update_compatible_version = true; |
| 376 return MigrateToVersion35GreatBritainCountryCodes(); |
| 377 // Combine migrations 36 and 37. This is due to enhancements to the merge |
| 378 // step when migrating profiles. The original migration from 35 to 36 did |
| 379 // not merge profiles with identical addresses, but the migration from 36 to |
| 380 // 37 does. The step from 35 to 36 should only happen on the Chrome 12 dev |
| 381 // channel. Chrome 12 beta and release users will jump from 35 to 37 |
| 382 // directly getting the full benefits of the multi-valued merge as well as |
| 383 // the culling of bad data. |
| 384 case 37: |
| 385 *update_compatible_version = true; |
| 386 return MigrateToVersion37MergeAndCullOlderProfiles(); |
| 387 } |
| 388 return true; |
| 389 } |
| 390 |
| 345 bool AutofillTable::AddFormFieldValues( | 391 bool AutofillTable::AddFormFieldValues( |
| 346 const std::vector<FormFieldData>& elements, | 392 const std::vector<FormFieldData>& elements, |
| 347 std::vector<AutofillChange>* changes) { | 393 std::vector<AutofillChange>* changes) { |
| 348 return AddFormFieldValuesTime(elements, changes, Time::Now()); | 394 return AddFormFieldValuesTime(elements, changes, Time::Now()); |
| 349 } | 395 } |
| 350 | 396 |
| 351 bool AutofillTable::AddFormFieldValue(const FormFieldData& element, | 397 bool AutofillTable::AddFormFieldValue(const FormFieldData& element, |
| 352 std::vector<AutofillChange>* changes) { | 398 std::vector<AutofillChange>* changes) { |
| 353 return AddFormFieldValueTime(element, changes, Time::Now()); | 399 return AddFormFieldValueTime(element, changes, Time::Now()); |
| 354 } | 400 } |
| (...skipping 1623 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1978 "WHERE guid=?")); | 2024 "WHERE guid=?")); |
| 1979 s_date.BindInt64(0, date_item->second); | 2025 s_date.BindInt64(0, date_item->second); |
| 1980 s_date.BindString(1, iter->guid()); | 2026 s_date.BindString(1, iter->guid()); |
| 1981 | 2027 |
| 1982 if (!s_date.Run()) | 2028 if (!s_date.Run()) |
| 1983 return false; | 2029 return false; |
| 1984 } | 2030 } |
| 1985 | 2031 |
| 1986 return true; | 2032 return true; |
| 1987 } | 2033 } |
| OLD | NEW |