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

Side by Side Diff: chrome/browser/ui/autofill/data_model_wrapper.h

Issue 14425010: Handle expired Autofill credit cards in autofill dialog (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 7 years, 8 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #ifndef CHROME_BROWSER_UI_AUTOFILL_DATA_MODEL_WRAPPER_H_ 5 #ifndef CHROME_BROWSER_UI_AUTOFILL_DATA_MODEL_WRAPPER_H_
6 #define CHROME_BROWSER_UI_AUTOFILL_DATA_MODEL_WRAPPER_H_ 6 #define CHROME_BROWSER_UI_AUTOFILL_DATA_MODEL_WRAPPER_H_
7 7
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/string16.h" 9 #include "base/string16.h"
10 #include "chrome/browser/ui/autofill/autofill_dialog_types.h" 10 #include "chrome/browser/ui/autofill/autofill_dialog_types.h"
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 virtual string16 GetDisplayText(); 49 virtual string16 GetDisplayText();
50 50
51 // Fills in |form_structure| with the data that this model contains. |inputs| 51 // Fills in |form_structure| with the data that this model contains. |inputs|
52 // and |comparator| are used to determine whether each field in the 52 // and |comparator| are used to determine whether each field in the
53 // FormStructure should be filled in or left alone. 53 // FormStructure should be filled in or left alone.
54 void FillFormStructure( 54 void FillFormStructure(
55 const DetailInputs& inputs, 55 const DetailInputs& inputs,
56 const InputFieldComparator& compare, 56 const InputFieldComparator& compare,
57 FormStructure* form_structure); 57 FormStructure* form_structure);
58 58
59 // Whether the wrapper has valid data (e.g. whether a credit card is expired).
60 virtual bool IsValid() const = 0;
Evan Stade 2013/04/24 22:00:17 no need to make this pure virtual why add this in
Dan Beam 2013/04/26 02:11:32 Done.
61
59 protected: 62 protected:
60 DataModelWrapper(); 63 DataModelWrapper();
61 64
62 // Fills in |field| with data from the model. 65 // Fills in |field| with data from the model.
63 virtual void FillFormField(AutofillField* field); 66 virtual void FillFormField(AutofillField* field);
64 67
65 private: 68 private:
66 DISALLOW_COPY_AND_ASSIGN(DataModelWrapper); 69 DISALLOW_COPY_AND_ASSIGN(DataModelWrapper);
67 }; 70 };
68 71
(...skipping 17 matching lines...) Expand all
86 DISALLOW_COPY_AND_ASSIGN(AutofillDataModelWrapper); 89 DISALLOW_COPY_AND_ASSIGN(AutofillDataModelWrapper);
87 }; 90 };
88 91
89 // A DataModelWrapper for Autofill profiles. 92 // A DataModelWrapper for Autofill profiles.
90 class AutofillProfileWrapper : public AutofillDataModelWrapper { 93 class AutofillProfileWrapper : public AutofillDataModelWrapper {
91 public: 94 public:
92 AutofillProfileWrapper(const AutofillProfile* profile, size_t variant); 95 AutofillProfileWrapper(const AutofillProfile* profile, size_t variant);
93 virtual ~AutofillProfileWrapper(); 96 virtual ~AutofillProfileWrapper();
94 97
95 virtual void FillInputs(DetailInputs* inputs) OVERRIDE; 98 virtual void FillInputs(DetailInputs* inputs) OVERRIDE;
99 virtual bool IsValid() const OVERRIDE;
96 100
97 private: 101 private:
98 const AutofillProfile* profile_; 102 const AutofillProfile* profile_;
99 103
100 DISALLOW_COPY_AND_ASSIGN(AutofillProfileWrapper); 104 DISALLOW_COPY_AND_ASSIGN(AutofillProfileWrapper);
101 }; 105 };
102 106
103 // A DataModelWrapper specifically for Autofill CreditCard data. 107 // A DataModelWrapper specifically for Autofill CreditCard data.
104 class AutofillCreditCardWrapper : public AutofillDataModelWrapper { 108 class AutofillCreditCardWrapper : public AutofillDataModelWrapper {
105 public: 109 public:
106 explicit AutofillCreditCardWrapper(const CreditCard* card); 110 explicit AutofillCreditCardWrapper(const CreditCard* card);
107 virtual ~AutofillCreditCardWrapper(); 111 virtual ~AutofillCreditCardWrapper();
108 112
109 virtual string16 GetInfo(AutofillFieldType type) OVERRIDE; 113 virtual string16 GetInfo(AutofillFieldType type) OVERRIDE;
110 virtual gfx::Image GetIcon() OVERRIDE; 114 virtual gfx::Image GetIcon() OVERRIDE;
111 virtual string16 GetDisplayText() OVERRIDE; 115 virtual string16 GetDisplayText() OVERRIDE;
116 virtual bool IsValid() const OVERRIDE;
112 117
113 protected: 118 protected:
114 virtual void FillFormField(AutofillField* field) OVERRIDE; 119 virtual void FillFormField(AutofillField* field) OVERRIDE;
115 120
116 private: 121 private:
117 const CreditCard* card_; 122 const CreditCard* card_;
118 123
119 DISALLOW_COPY_AND_ASSIGN(AutofillCreditCardWrapper); 124 DISALLOW_COPY_AND_ASSIGN(AutofillCreditCardWrapper);
120 }; 125 };
121 126
122 // A DataModelWrapper for Wallet addresses. 127 // A DataModelWrapper for Wallet addresses.
123 class WalletAddressWrapper : public DataModelWrapper { 128 class WalletAddressWrapper : public DataModelWrapper {
124 public: 129 public:
125 explicit WalletAddressWrapper(const wallet::Address* address); 130 explicit WalletAddressWrapper(const wallet::Address* address);
126 virtual ~WalletAddressWrapper(); 131 virtual ~WalletAddressWrapper();
127 132
128 virtual string16 GetInfo(AutofillFieldType type) OVERRIDE; 133 virtual string16 GetInfo(AutofillFieldType type) OVERRIDE;
134 virtual bool IsValid() const OVERRIDE;
129 135
130 private: 136 private:
131 const wallet::Address* address_; 137 const wallet::Address* address_;
132 138
133 DISALLOW_COPY_AND_ASSIGN(WalletAddressWrapper); 139 DISALLOW_COPY_AND_ASSIGN(WalletAddressWrapper);
134 }; 140 };
135 141
136 // A DataModelWrapper for Wallet instruments. 142 // A DataModelWrapper for Wallet instruments.
137 class WalletInstrumentWrapper : public DataModelWrapper { 143 class WalletInstrumentWrapper : public DataModelWrapper {
138 public: 144 public:
139 explicit WalletInstrumentWrapper( 145 explicit WalletInstrumentWrapper(
140 const wallet::WalletItems::MaskedInstrument* instrument); 146 const wallet::WalletItems::MaskedInstrument* instrument);
141 virtual ~WalletInstrumentWrapper(); 147 virtual ~WalletInstrumentWrapper();
142 148
143 virtual string16 GetInfo(AutofillFieldType type) OVERRIDE; 149 virtual string16 GetInfo(AutofillFieldType type) OVERRIDE;
144 virtual gfx::Image GetIcon() OVERRIDE; 150 virtual gfx::Image GetIcon() OVERRIDE;
145 virtual string16 GetDisplayText() OVERRIDE; 151 virtual string16 GetDisplayText() OVERRIDE;
152 virtual bool IsValid() const OVERRIDE;
146 153
147 private: 154 private:
148 const wallet::WalletItems::MaskedInstrument* instrument_; 155 const wallet::WalletItems::MaskedInstrument* instrument_;
149 156
150 DISALLOW_COPY_AND_ASSIGN(WalletInstrumentWrapper); 157 DISALLOW_COPY_AND_ASSIGN(WalletInstrumentWrapper);
151 }; 158 };
152 159
153 // A DataModelWrapper for FullWallets billing data. 160 // A DataModelWrapper for FullWallets billing data.
154 class FullWalletBillingWrapper : public DataModelWrapper { 161 class FullWalletBillingWrapper : public DataModelWrapper {
155 public: 162 public:
156 explicit FullWalletBillingWrapper(wallet::FullWallet* full_wallet); 163 explicit FullWalletBillingWrapper(wallet::FullWallet* full_wallet);
157 virtual ~FullWalletBillingWrapper(); 164 virtual ~FullWalletBillingWrapper();
158 165
159 virtual string16 GetInfo(AutofillFieldType type) OVERRIDE; 166 virtual string16 GetInfo(AutofillFieldType type) OVERRIDE;
167 virtual bool IsValid() const OVERRIDE;
160 168
161 private: 169 private:
162 wallet::FullWallet* full_wallet_; 170 wallet::FullWallet* full_wallet_;
163 171
164 DISALLOW_COPY_AND_ASSIGN(FullWalletBillingWrapper); 172 DISALLOW_COPY_AND_ASSIGN(FullWalletBillingWrapper);
165 }; 173 };
166 174
167 // A DataModelWrapper for FullWallets shipping data. 175 // A DataModelWrapper for FullWallets shipping data.
168 class FullWalletShippingWrapper : public DataModelWrapper { 176 class FullWalletShippingWrapper : public DataModelWrapper {
169 public: 177 public:
170 explicit FullWalletShippingWrapper(wallet::FullWallet* full_wallet); 178 explicit FullWalletShippingWrapper(wallet::FullWallet* full_wallet);
171 virtual ~FullWalletShippingWrapper(); 179 virtual ~FullWalletShippingWrapper();
172 180
173 virtual string16 GetInfo(AutofillFieldType type) OVERRIDE; 181 virtual string16 GetInfo(AutofillFieldType type) OVERRIDE;
182 virtual bool IsValid() const OVERRIDE;
174 183
175 private: 184 private:
176 wallet::FullWallet* full_wallet_; 185 wallet::FullWallet* full_wallet_;
177 186
178 DISALLOW_COPY_AND_ASSIGN(FullWalletShippingWrapper); 187 DISALLOW_COPY_AND_ASSIGN(FullWalletShippingWrapper);
179 }; 188 };
180 189
181 } // namespace autofill 190 } // namespace autofill
182 191
183 #endif // CHROME_BROWSER_UI_AUTOFILL_DATA_MODEL_WRAPPER_H_ 192 #endif // CHROME_BROWSER_UI_AUTOFILL_DATA_MODEL_WRAPPER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698