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_syncable_serv
ice.h" | 5 #include "components/autofill/core/browser/webdata/autofill_wallet_syncable_serv
ice.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <set> | 9 #include <map> |
10 #include <utility> | 10 #include <utility> |
11 | 11 |
12 #include "base/logging.h" | 12 #include "base/logging.h" |
13 #include "base/strings/string_piece.h" | 13 #include "base/strings/string_piece.h" |
14 #include "base/strings/string_util.h" | 14 #include "base/strings/string_util.h" |
15 #include "base/strings/utf_string_conversions.h" | 15 #include "base/strings/utf_string_conversions.h" |
16 #include "components/autofill/core/browser/webdata/autofill_table.h" | 16 #include "components/autofill/core/browser/webdata/autofill_table.h" |
17 #include "components/autofill/core/browser/webdata/autofill_webdata_backend.h" | 17 #include "components/autofill/core/browser/webdata/autofill_webdata_backend.h" |
18 #include "components/autofill/core/browser/webdata/autofill_webdata_service.h" | 18 #include "components/autofill/core/browser/webdata/autofill_webdata_service.h" |
19 #include "components/sync/model/sync_error_factory.h" | 19 #include "components/sync/model/sync_error_factory.h" |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 default: | 68 default: |
69 DCHECK_EQ(sync_pb::WalletMaskedCreditCard::EXPIRED, status); | 69 DCHECK_EQ(sync_pb::WalletMaskedCreditCard::EXPIRED, status); |
70 return CreditCard::EXPIRED; | 70 return CreditCard::EXPIRED; |
71 } | 71 } |
72 } | 72 } |
73 | 73 |
74 CreditCard CardFromSpecifics(const sync_pb::WalletMaskedCreditCard& card) { | 74 CreditCard CardFromSpecifics(const sync_pb::WalletMaskedCreditCard& card) { |
75 CreditCard result(CreditCard::MASKED_SERVER_CARD, card.id()); | 75 CreditCard result(CreditCard::MASKED_SERVER_CARD, card.id()); |
76 result.SetNumber(base::UTF8ToUTF16(card.last_four())); | 76 result.SetNumber(base::UTF8ToUTF16(card.last_four())); |
77 result.SetServerStatus(ServerToLocalStatus(card.status())); | 77 result.SetServerStatus(ServerToLocalStatus(card.status())); |
78 result.SetTypeForMaskedCard(CardTypeFromWalletCardType(card.type())); | 78 result.SetNetworkForMaskedCard(CardTypeFromWalletCardType(card.type())); |
79 result.SetRawInfo(CREDIT_CARD_NAME_FULL, | 79 result.SetRawInfo(CREDIT_CARD_NAME_FULL, |
80 base::UTF8ToUTF16(card.name_on_card())); | 80 base::UTF8ToUTF16(card.name_on_card())); |
81 result.SetExpirationMonth(card.exp_month()); | 81 result.SetExpirationMonth(card.exp_month()); |
82 result.SetExpirationYear(card.exp_year()); | 82 result.SetExpirationYear(card.exp_year()); |
83 result.set_billing_address_id(card.billing_address_id()); | 83 result.set_billing_address_id(card.billing_address_id()); |
84 return result; | 84 return result; |
85 } | 85 } |
86 | 86 |
87 AutofillProfile ProfileFromSpecifics( | 87 AutofillProfile ProfileFromSpecifics( |
88 const sync_pb::WalletPostalAddress& address) { | 88 const sync_pb::WalletPostalAddress& address) { |
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
354 static_cast<int>(prev_card_count + prev_address_count)); | 354 static_cast<int>(prev_card_count + prev_address_count)); |
355 merge_result.set_num_items_after_association( | 355 merge_result.set_num_items_after_association( |
356 static_cast<int>(wallet_cards.size() + wallet_addresses.size())); | 356 static_cast<int>(wallet_cards.size() + wallet_addresses.size())); |
357 | 357 |
358 if (webdata_backend_ && (changed_cards || changed_addresses)) | 358 if (webdata_backend_ && (changed_cards || changed_addresses)) |
359 webdata_backend_->NotifyOfMultipleAutofillChanges(); | 359 webdata_backend_->NotifyOfMultipleAutofillChanges(); |
360 | 360 |
361 return merge_result; | 361 return merge_result; |
362 } | 362 } |
363 | 363 |
364 } // namespace autofil | 364 } // namespace autofill |
OLD | NEW |