| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/sync/glue/autofill_model_associator.h" | 5 #include "chrome/browser/sync/glue/autofill_model_associator.h" |
| 6 | 6 |
| 7 #include <functional> | 7 #include <functional> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/string_number_conversions.h" | 10 #include "base/string_number_conversions.h" |
| (...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 236 bool autofill_profile_not_migrated = HasNotMigratedYet(write_trans); | 236 bool autofill_profile_not_migrated = HasNotMigratedYet(write_trans); |
| 237 | 237 |
| 238 if (VLOG_IS_ON(2) && autofill_profile_not_migrated) { | 238 if (VLOG_IS_ON(2) && autofill_profile_not_migrated) { |
| 239 VLOG(2) << "[AUTOFILL MIGRATION]" | 239 VLOG(2) << "[AUTOFILL MIGRATION]" |
| 240 << "Printing profiles from web db"; | 240 << "Printing profiles from web db"; |
| 241 | 241 |
| 242 for (std::vector<AutofillProfile*>::const_iterator ix = | 242 for (std::vector<AutofillProfile*>::const_iterator ix = |
| 243 all_profiles_from_db.begin(); ix != all_profiles_from_db.end(); ++ix) { | 243 all_profiles_from_db.begin(); ix != all_profiles_from_db.end(); ++ix) { |
| 244 AutofillProfile* p = *ix; | 244 AutofillProfile* p = *ix; |
| 245 VLOG(2) << "[AUTOFILL MIGRATION] " | 245 VLOG(2) << "[AUTOFILL MIGRATION] " |
| 246 << p->GetFieldText(AutofillType(NAME_FIRST)) | 246 << p->GetFieldText(NAME_FIRST) |
| 247 << p->GetFieldText(AutofillType(NAME_LAST)); | 247 << p->GetFieldText(NAME_LAST); |
| 248 } | 248 } |
| 249 } | 249 } |
| 250 | 250 |
| 251 if (autofill_profile_not_migrated) { | 251 if (autofill_profile_not_migrated) { |
| 252 VLOG(1) << "[AUTOFILL MIGRATION]" | 252 VLOG(1) << "[AUTOFILL MIGRATION]" |
| 253 << "Iterating over sync db"; | 253 << "Iterating over sync db"; |
| 254 } | 254 } |
| 255 | 255 |
| 256 int64 sync_child_id = autofill_root.GetFirstChildId(); | 256 int64 sync_child_id = autofill_root.GetFirstChildId(); |
| 257 while (sync_child_id != sync_api::kInvalidId) { | 257 while (sync_child_id != sync_api::kInvalidId) { |
| (...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 491 timestamp_union.begin(), | 491 timestamp_union.begin(), |
| 492 timestamp_union.end()); | 492 timestamp_union.end()); |
| 493 } | 493 } |
| 494 return different; | 494 return different; |
| 495 } | 495 } |
| 496 | 496 |
| 497 // Helper to compare the local value and cloud value of a field, merge into | 497 // Helper to compare the local value and cloud value of a field, merge into |
| 498 // the local value if they differ, and return whether the merge happened. | 498 // the local value if they differ, and return whether the merge happened. |
| 499 bool MergeField(FormGroup* f, AutofillFieldType t, | 499 bool MergeField(FormGroup* f, AutofillFieldType t, |
| 500 const std::string& specifics_field) { | 500 const std::string& specifics_field) { |
| 501 if (UTF16ToUTF8(f->GetFieldText(AutofillType(t))) == specifics_field) | 501 if (UTF16ToUTF8(f->GetFieldText(t)) == specifics_field) |
| 502 return false; | 502 return false; |
| 503 f->SetInfo(AutofillType(t), UTF8ToUTF16(specifics_field)); | 503 f->SetInfo(t, UTF8ToUTF16(specifics_field)); |
| 504 return true; | 504 return true; |
| 505 } | 505 } |
| 506 | 506 |
| 507 // static | 507 // static |
| 508 bool AutofillModelAssociator::FillProfileWithServerData( | 508 bool AutofillModelAssociator::FillProfileWithServerData( |
| 509 AutofillProfile* merge_into, | 509 AutofillProfile* merge_into, |
| 510 const sync_pb::AutofillProfileSpecifics& specifics) { | 510 const sync_pb::AutofillProfileSpecifics& specifics) { |
| 511 bool diff = false; | 511 bool diff = false; |
| 512 AutofillProfile* p = merge_into; | 512 AutofillProfile* p = merge_into; |
| 513 const sync_pb::AutofillProfileSpecifics& s(specifics); | 513 const sync_pb::AutofillProfileSpecifics& s(specifics); |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 569 sync_service_->SetAutofillMigrationState(syncable::MIGRATED); | 569 sync_service_->SetAutofillMigrationState(syncable::MIGRATED); |
| 570 | 570 |
| 571 VLOG(1) << "[AUTOFILL MIGRATION]" | 571 VLOG(1) << "[AUTOFILL MIGRATION]" |
| 572 << "Current autofill migration state is migrated."; | 572 << "Current autofill migration state is migrated."; |
| 573 } | 573 } |
| 574 | 574 |
| 575 return false; | 575 return false; |
| 576 } | 576 } |
| 577 | 577 |
| 578 } // namespace browser_sync | 578 } // namespace browser_sync |
| OLD | NEW |