Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(230)

Side by Side Diff: components/autofill/core/browser/webdata/autofill_wallet_syncable_service.cc

Issue 2695883003: Change uses of base::JoinString to pass StringPieces where possible. (Closed)
Patch Set: Remove dependency CL. Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <set>
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_util.h" 14 #include "base/strings/string_util.h"
14 #include "base/strings/utf_string_conversions.h" 15 #include "base/strings/utf_string_conversions.h"
15 #include "components/autofill/core/browser/webdata/autofill_table.h" 16 #include "components/autofill/core/browser/webdata/autofill_table.h"
16 #include "components/autofill/core/browser/webdata/autofill_webdata_backend.h" 17 #include "components/autofill/core/browser/webdata/autofill_webdata_backend.h"
17 #include "components/autofill/core/browser/webdata/autofill_webdata_service.h" 18 #include "components/autofill/core/browser/webdata/autofill_webdata_service.h"
18 #include "components/sync/model/sync_error_factory.h" 19 #include "components/sync/model/sync_error_factory.h"
19 #include "components/sync/protocol/sync.pb.h" 20 #include "components/sync/protocol/sync.pb.h"
20 21
21 namespace autofill { 22 namespace autofill {
22 23
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 result.SetExpirationYear(card.exp_year()); 80 result.SetExpirationYear(card.exp_year());
80 result.set_billing_address_id(card.billing_address_id()); 81 result.set_billing_address_id(card.billing_address_id());
81 return result; 82 return result;
82 } 83 }
83 84
84 AutofillProfile ProfileFromSpecifics( 85 AutofillProfile ProfileFromSpecifics(
85 const sync_pb::WalletPostalAddress& address) { 86 const sync_pb::WalletPostalAddress& address) {
86 AutofillProfile profile(AutofillProfile::SERVER_PROFILE, std::string()); 87 AutofillProfile profile(AutofillProfile::SERVER_PROFILE, std::string());
87 88
88 // AutofillProfile stores multi-line addresses with newline separators. 89 // AutofillProfile stores multi-line addresses with newline separators.
89 std::vector<std::string> street_address(address.street_address().begin(), 90 std::vector<base::StringPiece> street_address(
90 address.street_address().end()); 91 address.street_address().begin(), address.street_address().end());
91 profile.SetRawInfo(ADDRESS_HOME_STREET_ADDRESS, 92 profile.SetRawInfo(ADDRESS_HOME_STREET_ADDRESS,
92 base::UTF8ToUTF16(base::JoinString(street_address, "\n"))); 93 base::UTF8ToUTF16(base::JoinString(street_address, "\n")));
93 94
94 profile.SetRawInfo(COMPANY_NAME, base::UTF8ToUTF16(address.company_name())); 95 profile.SetRawInfo(COMPANY_NAME, base::UTF8ToUTF16(address.company_name()));
95 profile.SetRawInfo(ADDRESS_HOME_STATE, 96 profile.SetRawInfo(ADDRESS_HOME_STATE,
96 base::UTF8ToUTF16(address.address_1())); 97 base::UTF8ToUTF16(address.address_1()));
97 profile.SetRawInfo(ADDRESS_HOME_CITY, 98 profile.SetRawInfo(ADDRESS_HOME_CITY,
98 base::UTF8ToUTF16(address.address_2())); 99 base::UTF8ToUTF16(address.address_2()));
99 profile.SetRawInfo(ADDRESS_HOME_DEPENDENT_LOCALITY, 100 profile.SetRawInfo(ADDRESS_HOME_DEPENDENT_LOCALITY,
100 base::UTF8ToUTF16(address.address_3())); 101 base::UTF8ToUTF16(address.address_3()));
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
352 merge_result.set_num_items_after_association( 353 merge_result.set_num_items_after_association(
353 static_cast<int>(wallet_cards.size() + wallet_addresses.size())); 354 static_cast<int>(wallet_cards.size() + wallet_addresses.size()));
354 355
355 if (webdata_backend_ && (changed_cards || changed_addresses)) 356 if (webdata_backend_ && (changed_cards || changed_addresses))
356 webdata_backend_->NotifyOfMultipleAutofillChanges(); 357 webdata_backend_->NotifyOfMultipleAutofillChanges();
357 358
358 return merge_result; 359 return merge_result;
359 } 360 }
360 361
361 } // namespace autofil 362 } // namespace autofil
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698