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 "chrome/browser/extensions/api/autofill_private/autofill_util.h" | 5 #include "chrome/browser/extensions/api/autofill_private/autofill_util.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 address.country_code.reset( | 94 address.country_code.reset( |
95 GetStringFromProfile(profile, autofill::ADDRESS_HOME_COUNTRY).release()); | 95 GetStringFromProfile(profile, autofill::ADDRESS_HOME_COUNTRY).release()); |
96 address.phone_numbers = | 96 address.phone_numbers = |
97 GetValueList(profile, autofill::PHONE_HOME_WHOLE_NUMBER); | 97 GetValueList(profile, autofill::PHONE_HOME_WHOLE_NUMBER); |
98 address.email_addresses = GetValueList(profile, autofill::EMAIL_ADDRESS); | 98 address.email_addresses = GetValueList(profile, autofill::EMAIL_ADDRESS); |
99 address.language_code.reset(new std::string(profile.language_code())); | 99 address.language_code.reset(new std::string(profile.language_code())); |
100 | 100 |
101 // Parse |label| so that it can be used to create address metadata. | 101 // Parse |label| so that it can be used to create address metadata. |
102 base::string16 separator = | 102 base::string16 separator = |
103 l10n_util::GetStringUTF16(IDS_AUTOFILL_ADDRESS_SUMMARY_SEPARATOR); | 103 l10n_util::GetStringUTF16(IDS_AUTOFILL_ADDRESS_SUMMARY_SEPARATOR); |
104 std::vector<base::string16> label_pieces; | 104 std::vector<base::string16> label_pieces = base::SplitStringUsingSubstr( |
105 base::SplitStringUsingSubstr(label, separator, &label_pieces); | 105 label, separator, base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); |
106 | 106 |
107 // Create address metadata and add it to |address|. | 107 // Create address metadata and add it to |address|. |
108 std::unique_ptr<autofill_private::AutofillMetadata> metadata( | 108 std::unique_ptr<autofill_private::AutofillMetadata> metadata( |
109 new autofill_private::AutofillMetadata); | 109 new autofill_private::AutofillMetadata); |
110 metadata->summary_label = base::UTF16ToUTF8(label_pieces[0]); | 110 metadata->summary_label = base::UTF16ToUTF8(label_pieces[0]); |
111 metadata->summary_sublabel.reset(new std::string(base::UTF16ToUTF8( | 111 metadata->summary_sublabel.reset(new std::string(base::UTF16ToUTF8( |
112 label.substr(label_pieces[0].size())))); | 112 label.substr(label_pieces[0].size())))); |
113 metadata->is_local.reset(new bool( | 113 metadata->is_local.reset(new bool( |
114 profile.record_type() == autofill::AutofillProfile::LOCAL_PROFILE)); | 114 profile.record_type() == autofill::AutofillProfile::LOCAL_PROFILE)); |
115 address.metadata = std::move(metadata); | 115 address.metadata = std::move(metadata); |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 CreditCardEntryList list; | 209 CreditCardEntryList list; |
210 for (const autofill::CreditCard* card : cards) | 210 for (const autofill::CreditCard* card : cards) |
211 list.push_back(CreditCardToCreditCardEntry(*card)); | 211 list.push_back(CreditCardToCreditCardEntry(*card)); |
212 | 212 |
213 return list; | 213 return list; |
214 } | 214 } |
215 | 215 |
216 } // namespace autofill_util | 216 } // namespace autofill_util |
217 | 217 |
218 } // namespace extensions | 218 } // namespace extensions |
OLD | NEW |