| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "components/autofill/core/browser/webdata/autocomplete_sync_bridge.h" | 5 #include "components/autofill/core/browser/webdata/autocomplete_sync_bridge.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <set> | 8 #include <set> |
| 9 #include <unordered_set> | 9 #include <unordered_set> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 441 break; | 441 break; |
| 442 } | 442 } |
| 443 } | 443 } |
| 444 } | 444 } |
| 445 | 445 |
| 446 if (Optional<ModelError> error = metadata_change_list->TakeError()) | 446 if (Optional<ModelError> error = metadata_change_list->TakeError()) |
| 447 change_processor()->ReportError(error.value()); | 447 change_processor()->ReportError(error.value()); |
| 448 } | 448 } |
| 449 | 449 |
| 450 void AutocompleteSyncBridge::LoadMetadata() { | 450 void AutocompleteSyncBridge::LoadMetadata() { |
| 451 if (!web_data_backend_ || !web_data_backend_->GetDatabase() || |
| 452 !GetAutofillTable()) { |
| 453 change_processor()->ReportError(FROM_HERE, |
| 454 "Failed to load AutofillWebDatabase."); |
| 455 return; |
| 456 } |
| 457 |
| 451 auto batch = base::MakeUnique<syncer::MetadataBatch>(); | 458 auto batch = base::MakeUnique<syncer::MetadataBatch>(); |
| 452 if (!GetAutofillTable()->GetAllSyncMetadata(syncer::AUTOFILL, batch.get())) { | 459 if (!GetAutofillTable()->GetAllSyncMetadata(syncer::AUTOFILL, batch.get())) { |
| 453 change_processor()->ReportError( | 460 change_processor()->ReportError( |
| 454 FROM_HERE, "Failed reading autofill metadata from WebDatabase."); | 461 FROM_HERE, "Failed reading autofill metadata from WebDatabase."); |
| 455 return; | 462 return; |
| 456 } | 463 } |
| 457 change_processor()->ModelReadyToSync(std::move(batch)); | 464 change_processor()->ModelReadyToSync(std::move(batch)); |
| 458 } | 465 } |
| 459 | 466 |
| 460 std::string AutocompleteSyncBridge::GetClientTag( | 467 std::string AutocompleteSyncBridge::GetClientTag( |
| (...skipping 21 matching lines...) Expand all Loading... |
| 482 const AutofillChangeList& changes) { | 489 const AutofillChangeList& changes) { |
| 483 DCHECK(thread_checker_.CalledOnValidThread()); | 490 DCHECK(thread_checker_.CalledOnValidThread()); |
| 484 ActOnLocalChanges(changes); | 491 ActOnLocalChanges(changes); |
| 485 } | 492 } |
| 486 | 493 |
| 487 AutofillTable* AutocompleteSyncBridge::GetAutofillTable() const { | 494 AutofillTable* AutocompleteSyncBridge::GetAutofillTable() const { |
| 488 return AutofillTable::FromWebDatabase(web_data_backend_->GetDatabase()); | 495 return AutofillTable::FromWebDatabase(web_data_backend_->GetDatabase()); |
| 489 } | 496 } |
| 490 | 497 |
| 491 } // namespace autofill | 498 } // namespace autofill |
| OLD | NEW |