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

Unified Diff: chrome/browser/autofill/wallet/wallet_address.cc

Issue 12208070: allow wallet items to appear in requestAutocomplete UI (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: clang fix Created 7 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/autofill/wallet/wallet_address.cc
diff --git a/chrome/browser/autofill/wallet/wallet_address.cc b/chrome/browser/autofill/wallet/wallet_address.cc
index 6ae1d6f85fd51e757efeab51556e27cc24822ce8..da75f1d569f6722ba661aedd86585fbc5d8e3816 100644
--- a/chrome/browser/autofill/wallet/wallet_address.cc
+++ b/chrome/browser/autofill/wallet/wallet_address.cc
@@ -5,6 +5,7 @@
#include "chrome/browser/autofill/wallet/wallet_address.h"
#include "base/logging.h"
+#include "base/utf_string_conversions.h"
#include "base/values.h"
namespace wallet {
@@ -62,6 +63,37 @@ scoped_ptr<base::DictionaryValue> Address::ToDictionaryWithoutID() const {
return dict.Pass();
}
+string16 Address::DisplayName() const {
+ // TODO(estade): improve this stub implementation.
+ return UTF8ToUTF16(recipient_name() + ", " + address_line_1());
+}
+
+string16 Address::GetInfo(AutofillFieldType type) const {
+ switch (type) {
+ case NAME_FULL:
+ return UTF8ToUTF16(recipient_name());
+
+ case ADDRESS_HOME_LINE1:
+ return UTF8ToUTF16(address_line_1());
+
+ case ADDRESS_HOME_LINE2:
+ return UTF8ToUTF16(address_line_2());
+
+ case ADDRESS_HOME_CITY:
+ return UTF8ToUTF16(locality_name());
+
+ case ADDRESS_HOME_STATE:
+ return UTF8ToUTF16(admin_area_name());
+
+ case ADDRESS_HOME_ZIP:
+ return UTF8ToUTF16(postal_code_number());
+
+ // TODO(estade): implement more.
+ default:
+ NOTREACHED();
+ return string16();
+ }
+}
scoped_ptr<Address>
Address::CreateAddressWithID(const base::DictionaryValue& dictionary) {

Powered by Google App Engine
This is Rietveld 408576698