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

Side by Side Diff: chrome/browser/autofill/wallet/full_wallet.cc

Issue 12388059: Adds wallet::Address::CreateAddress() for when IDs are optional (for billing addresses). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 7 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/autofill/wallet/full_wallet_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/autofill/wallet/full_wallet.h" 5 #include "chrome/browser/autofill/wallet/full_wallet.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/strings/string_number_conversions.h" 8 #include "base/strings/string_number_conversions.h"
9 #include "base/values.h" 9 #include "base/values.h"
10 10
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 return scoped_ptr<FullWallet>(); 92 return scoped_ptr<FullWallet>();
93 } 93 }
94 94
95 const DictionaryValue* billing_address_dict; 95 const DictionaryValue* billing_address_dict;
96 if (!dictionary.GetDictionary("billing_address", &billing_address_dict)) { 96 if (!dictionary.GetDictionary("billing_address", &billing_address_dict)) {
97 DLOG(ERROR) << "Response from Google wallet missing billing address"; 97 DLOG(ERROR) << "Response from Google wallet missing billing address";
98 return scoped_ptr<FullWallet>(); 98 return scoped_ptr<FullWallet>();
99 } 99 }
100 100
101 scoped_ptr<Address> billing_address = 101 scoped_ptr<Address> billing_address =
102 Address::CreateAddressWithID(*billing_address_dict); 102 Address::CreateAddress(*billing_address_dict);
103 if (!billing_address.get()) { 103 if (!billing_address.get()) {
104 DLOG(ERROR) << "Response from Google wallet has malformed billing address"; 104 DLOG(ERROR) << "Response from Google wallet has malformed billing address";
105 return scoped_ptr<FullWallet>(); 105 return scoped_ptr<FullWallet>();
106 } 106 }
107 107
108 const DictionaryValue* shipping_address_dict; 108 const DictionaryValue* shipping_address_dict;
109 scoped_ptr<Address> shipping_address; 109 scoped_ptr<Address> shipping_address;
110 if (dictionary.GetDictionary("shipping_address", &shipping_address_dict)) { 110 if (dictionary.GetDictionary("shipping_address", &shipping_address_dict)) {
111 shipping_address = 111 shipping_address =
112 Address::CreateAddressWithID(*shipping_address_dict); 112 Address::CreateAddressWithID(*shipping_address_dict);
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 card_info.insert(card_info.begin(), padded_length - card_info.size(), '0'); 215 card_info.insert(card_info.begin(), padded_length - card_info.size(), '0');
216 216
217 // Separate out the PAN from the CVN. 217 // Separate out the PAN from the CVN.
218 size_t split = kPanSize - kBinSize; 218 size_t split = kPanSize - kBinSize;
219 cvn_ = card_info.substr(split); 219 cvn_ = card_info.substr(split);
220 pan_ = iin_ + card_info.substr(0, split); 220 pan_ = iin_ + card_info.substr(0, split);
221 } 221 }
222 222
223 } // namespace wallet 223 } // namespace wallet
224 } // namespace autofill 224 } // namespace autofill
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/autofill/wallet/full_wallet_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698