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

Side by Side Diff: components/autofill/content/browser/wallet/full_wallet.h

Issue 1931043002: Remove requestAutocomplete (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 7 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
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef COMPONENTS_AUTOFILL_CONTENT_BROWSER_WALLET_FULL_WALLET_H_
6 #define COMPONENTS_AUTOFILL_CONTENT_BROWSER_WALLET_FULL_WALLET_H_
7
8 #include <stdint.h>
9
10 #include <memory>
11 #include <string>
12 #include <vector>
13
14 #include "base/gtest_prod_util.h"
15 #include "base/macros.h"
16 #include "base/strings/string16.h"
17 #include "components/autofill/content/browser/wallet/wallet_address.h"
18
19 namespace base {
20 class DictionaryValue;
21 }
22
23 namespace autofill {
24
25 class AutofillType;
26
27 namespace wallet {
28
29 class FullWalletTest;
30
31 // FullWallet contains all the information a merchant requires from a user for
32 // that user to make a purchase. This includes:
33 // - billing information
34 // - shipping information
35 // - a proxy card for the backing card selected from a user's wallet items
36 class FullWallet {
37 public:
38 ~FullWallet();
39
40 // Returns a wallet built from the provided clear-text data.
41 // Data is not validated; |pan|, |cvn| and |billing_address| must be set.
42 static std::unique_ptr<FullWallet> CreateFullWalletFromClearText(
43 int expiration_month,
44 int expiration_year,
45 const std::string& pan,
46 const std::string& cvn,
47 std::unique_ptr<Address> billing_address,
48 std::unique_ptr<Address> shipping_address);
49
50 // Returns corresponding data for |type|.
51 base::string16 GetInfo(const std::string& app_locale,
52 const AutofillType& type);
53
54 // The type of the card that this FullWallet contains and the last four digits
55 // like this "Visa - 4111".
56 base::string16 TypeAndLastFourDigits();
57
58 // Decrypts and returns the primary account number (PAN) using the generated
59 // one time pad, |one_time_pad_|.
60 const std::string& GetPan();
61
62 bool operator==(const FullWallet& other) const;
63 bool operator!=(const FullWallet& other) const;
64
65 const Address* billing_address() const { return billing_address_.get(); }
66 const Address* shipping_address() const { return shipping_address_.get(); }
67
68 int expiration_month() const { return expiration_month_; }
69 int expiration_year() const { return expiration_year_; }
70
71 void set_one_time_pad(const std::vector<uint8_t>& one_time_pad) {
72 one_time_pad_ = one_time_pad;
73 }
74
75 private:
76 friend class FullWalletTest;
77 friend std::unique_ptr<FullWallet> GetTestFullWallet();
78 friend std::unique_ptr<FullWallet> GetTestFullWalletInstrumentOnly();
79 FRIEND_TEST_ALL_PREFIXES(FullWalletTest, CreateFullWallet);
80 FRIEND_TEST_ALL_PREFIXES(FullWalletTest, RestLengthCorrectDecryptionTest);
81 FRIEND_TEST_ALL_PREFIXES(FullWalletTest, RestLengthUnderDecryptionTest);
82 FRIEND_TEST_ALL_PREFIXES(FullWalletTest, GetCreditCardInfo);
83
84 FullWallet(int expiration_month,
85 int expiration_year,
86 const std::string& iin,
87 const std::string& encrypted_rest,
88 std::unique_ptr<Address> billing_address,
89 std::unique_ptr<Address> shipping_address);
90
91 // Decrypts both |pan_| and |cvn_|.
92 void DecryptCardInfo();
93
94 // Decrypts and returns the card verification number (CVN) using the generated
95 // one time pad, |one_time_pad_|.
96 const std::string& GetCvn();
97
98 // The expiration month of the proxy card. It should be 1-12.
99 int expiration_month_;
100
101 // The expiration year of the proxy card. It should be a 4-digit year.
102 int expiration_year_;
103
104 // Primary account number (PAN). Its format is \d{16}.
105 std::string pan_;
106
107 // Card verification number (CVN). Its format is \d{3}.
108 std::string cvn_;
109
110 // Issuer identification number (IIN). Its format is \d{6}.
111 std::string iin_;
112
113 // Encrypted concatentation of CVN and PAN without IIN
114 std::string encrypted_rest_;
115
116 // The billing address of the backing instrument.
117 std::unique_ptr<Address> billing_address_;
118
119 // The shipping address for the transaction.
120 std::unique_ptr<Address> shipping_address_;
121
122 // The one time pad used for FullWallet encryption.
123 std::vector<uint8_t> one_time_pad_;
124
125 DISALLOW_COPY_AND_ASSIGN(FullWallet);
126 };
127
128 } // namespace wallet
129 } // namespace autofill
130
131 #endif // COMPONENTS_AUTOFILL_CONTENT_BROWSER_WALLET_FULL_WALLET_H_
OLDNEW
« no previous file with comments | « components/autofill/content/browser/wallet/BUILD.gn ('k') | components/autofill/content/browser/wallet/full_wallet.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698