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

Side by Side Diff: components/autofill/content/browser/wallet/wallet_address.cc

Issue 111853012: rAc: support street-address. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 6 years, 11 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/content/browser/wallet/wallet_address.h" 5 #include "components/autofill/content/browser/wallet/wallet_address.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/strings/string_util.h" 8 #include "base/strings/string_util.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "base/values.h" 10 #include "base/values.h"
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 // Wallet only supports the US right now, stick to national formatting. 273 // Wallet only supports the US right now, stick to national formatting.
274 return i18n::PhoneObject(phone_number(), country_name_code()). 274 return i18n::PhoneObject(phone_number(), country_name_code()).
275 GetNationallyFormattedNumber(); 275 GetNationallyFormattedNumber();
276 } 276 }
277 277
278 base::string16 Address::GetInfo(const AutofillType& type, 278 base::string16 Address::GetInfo(const AutofillType& type,
279 const std::string& app_locale) const { 279 const std::string& app_locale) const {
280 if (type.html_type() == HTML_TYPE_COUNTRY_CODE) { 280 if (type.html_type() == HTML_TYPE_COUNTRY_CODE) {
281 DCHECK(IsStringASCII(country_name_code())); 281 DCHECK(IsStringASCII(country_name_code()));
282 return base::ASCIIToUTF16(country_name_code()); 282 return base::ASCIIToUTF16(country_name_code());
283 } else if (type.html_type() == HTML_TYPE_STREET_ADDRESS) {
284 base::string16 address = address_line_1();
285 if (!address_line_2().empty())
286 address += base::ASCIIToUTF16(", ") + address_line_2();
287 return address;
288 } 283 }
289 284
290 switch (type.GetStorableType()) { 285 switch (type.GetStorableType()) {
291 case NAME_FULL: 286 case NAME_FULL:
292 return recipient_name(); 287 return recipient_name();
293 288
289 case ADDRESS_HOME_STREET_ADDRESS: {
290 base::string16 address = address_line_1();
291 if (!address_line_2().empty())
292 address += base::ASCIIToUTF16("\n") + address_line_2();
293 return address;
294 }
295
294 case ADDRESS_HOME_LINE1: 296 case ADDRESS_HOME_LINE1:
295 return address_line_1(); 297 return address_line_1();
296 298
297 case ADDRESS_HOME_LINE2: 299 case ADDRESS_HOME_LINE2:
298 return address_line_2(); 300 return address_line_2();
299 301
300 case ADDRESS_HOME_CITY: 302 case ADDRESS_HOME_CITY:
301 return locality_name(); 303 return locality_name();
302 304
303 case ADDRESS_HOME_STATE: 305 case ADDRESS_HOME_STATE:
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
350 bool Address::operator==(const Address& other) const { 352 bool Address::operator==(const Address& other) const {
351 return object_id_ == other.object_id_ && EqualsIgnoreID(other); 353 return object_id_ == other.object_id_ && EqualsIgnoreID(other);
352 } 354 }
353 355
354 bool Address::operator!=(const Address& other) const { 356 bool Address::operator!=(const Address& other) const {
355 return !(*this == other); 357 return !(*this == other);
356 } 358 }
357 359
358 } // namespace wallet 360 } // namespace wallet
359 } // namespace autofill 361 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698