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

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
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..10fb03111c4088b18c2b2f7b663ee1d15ee5b7bb 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,43 @@ scoped_ptr<FullWallet>
required_actions));
}
+const std::string& FullWallet::GetPan() {
+ if (pan_.empty())
+ DecryptCardInfo();
+ return pan_;
+}
+
+const std::string& FullWallet::GetCvn() {
+ if (cvn_.empty())
+ DecryptCardInfo();
+ return cvn_;
+}
+
+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:
+ case CREDIT_CARD_EXP_DATE_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 +205,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|.

Powered by Google App Engine
This is Rietveld 408576698