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

Unified Diff: components/autofill/browser/wallet/full_wallet.cc

Issue 12815002: requestAutocomplete: Fill |form_structure_| from Online Wallet data (including (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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/autofill/browser/wallet/full_wallet.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/autofill/browser/wallet/full_wallet.cc
diff --git a/components/autofill/browser/wallet/full_wallet.cc b/components/autofill/browser/wallet/full_wallet.cc
index 875ce6c0ba0d713796fb0e04945a1250232c1cb7..97c584bbf5db3627ca17dc34aaa49752b49caf4a 100644
--- a/components/autofill/browser/wallet/full_wallet.cc
+++ b/components/autofill/browser/wallet/full_wallet.cc
@@ -6,6 +6,7 @@
#include "base/logging.h"
#include "base/strings/string_number_conversions.h"
+#include "base/utf_string_conversions.h"
#include "base/values.h"
namespace {
@@ -123,6 +124,30 @@ scoped_ptr<FullWallet>
required_actions));
}
+string16 FullWallet::GetInfo(AutofillFieldType type) {
+ switch (type) {
+ case CREDIT_CARD_NUMBER:
+ return UTF8ToUTF16(GetPan());
+
+ case CREDIT_CARD_NAME:
+ return billing_address()->recipient_name();
+
+ case CREDIT_CARD_VERIFICATION_CODE:
+ return UTF8ToUTF16(GetCvn());
+
+ case CREDIT_CARD_EXP_MONTH:
+ return base::IntToString16(expiration_month());
+
+ case CREDIT_CARD_EXP_4_DIGIT_YEAR:
+ return base::IntToString16(expiration_year());
+
+ default:
+ NOTREACHED();
+ }
+
+ return string16();
+}
+
bool FullWallet::HasRequiredAction(RequiredAction action) const {
DCHECK(ActionAppliesToFullWallet(action));
return std::find(required_actions_.begin(),
@@ -167,18 +192,6 @@ bool FullWallet::operator!=(const FullWallet& other) const {
return !(*this == other);
}
-const std::string& FullWallet::GetPan() {
- if (pan_.empty())
- DecryptCardInfo();
- return pan_;
-}
-
-const std::string& FullWallet::GetCvn() {
- if (cvn_.empty())
- DecryptCardInfo();
- return cvn_;
-}
-
void FullWallet::DecryptCardInfo() {
std::vector<uint8> operating_data;
// Convert |encrypted_rest_| to bytes so we can decrypt it with |otp|.
@@ -220,5 +233,17 @@ void FullWallet::DecryptCardInfo() {
pan_ = iin_ + card_info.substr(0, split);
}
+const std::string& FullWallet::GetPan() {
+ if (pan_.empty())
+ DecryptCardInfo();
+ return pan_;
+}
+
+const std::string& FullWallet::GetCvn() {
+ if (cvn_.empty())
+ DecryptCardInfo();
+ return cvn_;
+}
+
} // namespace wallet
} // namespace autofill
« no previous file with comments | « components/autofill/browser/wallet/full_wallet.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698