OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/autofill_wallet_metadata_sync
able_service.h" | 5 #include "components/autofill/core/browser/webdata/autofill_wallet_metadata_sync
able_service.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
401 bool AutofillWalletMetadataSyncableService::GetLocalData( | 401 bool AutofillWalletMetadataSyncableService::GetLocalData( |
402 base::ScopedPtrHashMap<std::string, std::unique_ptr<AutofillProfile>>* | 402 base::ScopedPtrHashMap<std::string, std::unique_ptr<AutofillProfile>>* |
403 profiles, | 403 profiles, |
404 base::ScopedPtrHashMap<std::string, std::unique_ptr<CreditCard>>* cards) | 404 base::ScopedPtrHashMap<std::string, std::unique_ptr<CreditCard>>* cards) |
405 const { | 405 const { |
406 std::vector<std::unique_ptr<AutofillProfile>> profile_list; | 406 std::vector<std::unique_ptr<AutofillProfile>> profile_list; |
407 bool success = | 407 bool success = |
408 AutofillTable::FromWebDatabase(web_data_backend_->GetDatabase()) | 408 AutofillTable::FromWebDatabase(web_data_backend_->GetDatabase()) |
409 ->GetServerProfiles(&profile_list); | 409 ->GetServerProfiles(&profile_list); |
410 while (!profile_list.empty()) { | 410 while (!profile_list.empty()) { |
411 profiles->add(GetServerId(*profile_list.front()), | 411 auto server_id = GetServerId(*profile_list.front()); |
412 std::move(profile_list.front())); | 412 profiles->add(server_id, std::move(profile_list.front())); |
413 profile_list.erase(profile_list.begin()); | 413 profile_list.erase(profile_list.begin()); |
414 } | 414 } |
415 | 415 |
416 std::vector<std::unique_ptr<CreditCard>> card_list; | 416 std::vector<std::unique_ptr<CreditCard>> card_list; |
417 success &= AutofillTable::FromWebDatabase(web_data_backend_->GetDatabase()) | 417 success &= AutofillTable::FromWebDatabase(web_data_backend_->GetDatabase()) |
418 ->GetServerCreditCards(&card_list); | 418 ->GetServerCreditCards(&card_list); |
419 while (!card_list.empty()) { | 419 while (!card_list.empty()) { |
420 auto server_id = GetServerId(*card_list.front()); | 420 auto server_id = GetServerId(*card_list.front()); |
421 cards->add(server_id, std::move(card_list.front())); | 421 cards->add(server_id, std::move(card_list.front())); |
422 card_list.erase(card_list.begin()); | 422 card_list.erase(card_list.begin()); |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
530 it->GetSpecifics().wallet_metadata(); | 530 it->GetSpecifics().wallet_metadata(); |
531 if (base::checked_cast<size_t>(remote.use_count()) < local.use_count() && | 531 if (base::checked_cast<size_t>(remote.use_count()) < local.use_count() && |
532 base::Time::FromInternalValue(remote.use_date()) < local.use_date()) { | 532 base::Time::FromInternalValue(remote.use_date()) < local.use_date()) { |
533 SendChangesToSyncServer(syncer::SyncChangeList( | 533 SendChangesToSyncServer(syncer::SyncChangeList( |
534 1, syncer::SyncChange(FROM_HERE, syncer::SyncChange::ACTION_UPDATE, | 534 1, syncer::SyncChange(FROM_HERE, syncer::SyncChange::ACTION_UPDATE, |
535 BuildSyncData(remote.type(), server_id, local)))); | 535 BuildSyncData(remote.type(), server_id, local)))); |
536 } | 536 } |
537 } | 537 } |
538 | 538 |
539 } // namespace autofill | 539 } // namespace autofill |
OLD | NEW |