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

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

Issue 12893007: Implementing VERIFY_CVV required action. (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 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 14 matching lines...) Expand all
25 namespace wallet { 25 namespace wallet {
26 class Address; 26 class Address;
27 class FullWallet; 27 class FullWallet;
28 } 28 }
29 29
30 // A glue class that allows uniform interactions with autocomplete data sources, 30 // A glue class that allows uniform interactions with autocomplete data sources,
31 // regardless of their type. Implementations are intended to be lightweight and 31 // regardless of their type. Implementations are intended to be lightweight and
32 // copyable, only holding weak references to their backing model. 32 // copyable, only holding weak references to their backing model.
33 class DataModelWrapper { 33 class DataModelWrapper {
34 public: 34 public:
35 DataModelWrapper();
35 virtual ~DataModelWrapper(); 36 virtual ~DataModelWrapper();
36 37
37 // Returns the data for a specific autocomplete type. 38 // Returns the data for a specific autocomplete type.
38 virtual string16 GetInfo(AutofillFieldType type) = 0; 39 virtual string16 GetInfo(AutofillFieldType type) = 0;
39 40
40 // Returns the icon, if any, that represents this model. 41 // Returns the icon, if any, that represents this model.
41 virtual gfx::Image GetIcon(); 42 virtual gfx::Image GetIcon();
42 43
43 // Fills in |inputs| with the data that this model contains (|inputs| is an 44 // Fills in |inputs| with the data that this model contains (|inputs| is an
44 // out-param). 45 // out-param).
45 virtual void FillInputs(DetailInputs* inputs); 46 virtual void FillInputs(DetailInputs* inputs);
46 47
47 // Returns text to display to the user to summarize this data source. The 48 // Returns text to display to the user to summarize this data source. The
48 // default implementation assumes this is an address. 49 // default implementation assumes this is an address.
49 virtual string16 GetDisplayText(); 50 virtual string16 GetDisplayText();
50 51
51 // Fills in |form_structure| with the data that this model contains. |inputs| 52 // Fills in |form_structure| with the data that this model contains. |inputs|
52 // and |comparator| are used to determine whether each field in the 53 // and |comparator| are used to determine whether each field in the
53 // FormStructure should be filled in or left alone. 54 // FormStructure should be filled in or left alone.
54 void FillFormStructure( 55 void FillFormStructure(
55 const DetailInputs& inputs, 56 const DetailInputs& inputs,
56 const InputFieldComparator& compare, 57 const InputFieldComparator& compare,
57 FormStructure* form_structure); 58 FormStructure* form_structure);
58 59
59 protected: 60 protected:
60 // Fills in |field| with data from the model. 61 // Fills in |field| with data from the model.
61 virtual void FillFormField(AutofillField* field); 62 virtual void FillFormField(AutofillField* field);
63
64 DISALLOW_COPY_AND_ASSIGN(DataModelWrapper);
ahutter 2013/03/26 15:27:09 I think this needs to be private.
Dan Beam 2013/03/26 18:03:14 Done.
62 }; 65 };
63 66
64 // A DataModelWrapper for Autofill data. 67 // A DataModelWrapper for Autofill data.
65 class AutofillFormGroupWrapper : public DataModelWrapper { 68 class AutofillFormGroupWrapper : public DataModelWrapper {
66 public: 69 public:
67 AutofillFormGroupWrapper(const FormGroup* form_group, size_t variant); 70 AutofillFormGroupWrapper(const FormGroup* form_group, size_t variant);
68 virtual ~AutofillFormGroupWrapper(); 71 virtual ~AutofillFormGroupWrapper();
69 72
70 virtual string16 GetInfo(AutofillFieldType type) OVERRIDE; 73 virtual string16 GetInfo(AutofillFieldType type) OVERRIDE;
71 74
72 protected: 75 protected:
73 virtual void FillFormField(AutofillField* field) OVERRIDE; 76 virtual void FillFormField(AutofillField* field) OVERRIDE;
74 77
75 size_t variant() const { return variant_; } 78 size_t variant() const { return variant_; }
76 79
77 private: 80 private:
78 const FormGroup* form_group_; 81 const FormGroup* form_group_;
79 const size_t variant_; 82 const size_t variant_;
83
84 DISALLOW_COPY_AND_ASSIGN(AutofillFormGroupWrapper);
80 }; 85 };
81 86
82 // A DataModelWrapper for Autofill profiles. 87 // A DataModelWrapper for Autofill profiles.
83 class AutofillProfileWrapper : public AutofillFormGroupWrapper { 88 class AutofillProfileWrapper : public AutofillFormGroupWrapper {
84 public: 89 public:
85 AutofillProfileWrapper(const AutofillProfile* profile, size_t variant); 90 AutofillProfileWrapper(const AutofillProfile* profile, size_t variant);
86 virtual ~AutofillProfileWrapper(); 91 virtual ~AutofillProfileWrapper();
87 92
88 virtual void FillInputs(DetailInputs* inputs) OVERRIDE; 93 virtual void FillInputs(DetailInputs* inputs) OVERRIDE;
89 94
90 private: 95 private:
91 const AutofillProfile* profile_; 96 const AutofillProfile* profile_;
97
98 DISALLOW_COPY_AND_ASSIGN(AutofillProfileWrapper);
92 }; 99 };
93 100
94 // A DataModelWrapper specifically for Autofill CreditCard data. 101 // A DataModelWrapper specifically for Autofill CreditCard data.
95 class AutofillCreditCardWrapper : public AutofillFormGroupWrapper { 102 class AutofillCreditCardWrapper : public AutofillFormGroupWrapper {
96 public: 103 public:
97 explicit AutofillCreditCardWrapper(const CreditCard* card); 104 explicit AutofillCreditCardWrapper(const CreditCard* card);
98 virtual ~AutofillCreditCardWrapper(); 105 virtual ~AutofillCreditCardWrapper();
99 106
100 virtual string16 GetInfo(AutofillFieldType type) OVERRIDE; 107 virtual string16 GetInfo(AutofillFieldType type) OVERRIDE;
101 virtual gfx::Image GetIcon() OVERRIDE; 108 virtual gfx::Image GetIcon() OVERRIDE;
102 virtual string16 GetDisplayText() OVERRIDE; 109 virtual string16 GetDisplayText() OVERRIDE;
103 110
104 protected: 111 protected:
105 virtual void FillFormField(AutofillField* field) OVERRIDE; 112 virtual void FillFormField(AutofillField* field) OVERRIDE;
106 113
107 private: 114 private:
108 const CreditCard* card_; 115 const CreditCard* card_;
116
117 DISALLOW_COPY_AND_ASSIGN(AutofillCreditCardWrapper);
109 }; 118 };
110 119
111 // A DataModelWrapper for Wallet addresses. 120 // A DataModelWrapper for Wallet addresses.
112 class WalletAddressWrapper : public DataModelWrapper { 121 class WalletAddressWrapper : public DataModelWrapper {
113 public: 122 public:
114 explicit WalletAddressWrapper(const wallet::Address* address); 123 explicit WalletAddressWrapper(const wallet::Address* address);
115 virtual ~WalletAddressWrapper(); 124 virtual ~WalletAddressWrapper();
116 125
117 virtual string16 GetInfo(AutofillFieldType type) OVERRIDE; 126 virtual string16 GetInfo(AutofillFieldType type) OVERRIDE;
118 127
119 private: 128 private:
120 const wallet::Address* address_; 129 const wallet::Address* address_;
130
131 DISALLOW_COPY_AND_ASSIGN(WalletAddressWrapper);
121 }; 132 };
122 133
123 // A DataModelWrapper for Wallet instruments. 134 // A DataModelWrapper for Wallet instruments.
124 class WalletInstrumentWrapper : public DataModelWrapper { 135 class WalletInstrumentWrapper : public DataModelWrapper {
125 public: 136 public:
126 explicit WalletInstrumentWrapper( 137 explicit WalletInstrumentWrapper(
127 const wallet::WalletItems::MaskedInstrument* instrument); 138 const wallet::WalletItems::MaskedInstrument* instrument);
128 virtual ~WalletInstrumentWrapper(); 139 virtual ~WalletInstrumentWrapper();
129 140
130 virtual string16 GetInfo(AutofillFieldType type) OVERRIDE; 141 virtual string16 GetInfo(AutofillFieldType type) OVERRIDE;
131 virtual gfx::Image GetIcon() OVERRIDE; 142 virtual gfx::Image GetIcon() OVERRIDE;
132 virtual string16 GetDisplayText() OVERRIDE; 143 virtual string16 GetDisplayText() OVERRIDE;
133 144
134 private: 145 private:
135 const wallet::WalletItems::MaskedInstrument* instrument_; 146 const wallet::WalletItems::MaskedInstrument* instrument_;
136 }; 147 };
137 148
138 // A DataModelWrapper for FullWallets billing data. 149 // A DataModelWrapper for FullWallets billing data.
139 class FullWalletBillingWrapper : public DataModelWrapper { 150 class FullWalletBillingWrapper : public DataModelWrapper {
140 public: 151 public:
141 explicit FullWalletBillingWrapper(wallet::FullWallet* full_wallet); 152 explicit FullWalletBillingWrapper(wallet::FullWallet* full_wallet);
142 virtual ~FullWalletBillingWrapper(); 153 virtual ~FullWalletBillingWrapper();
143 154
144 virtual string16 GetInfo(AutofillFieldType type) OVERRIDE; 155 virtual string16 GetInfo(AutofillFieldType type) OVERRIDE;
145 156
146 private: 157 private:
147 wallet::FullWallet* full_wallet_; 158 wallet::FullWallet* full_wallet_;
159
160 DISALLOW_COPY_AND_ASSIGN(FullWalletBillingWrapper);
148 }; 161 };
149 162
150 // A DataModelWrapper for FullWallets shipping data. 163 // A DataModelWrapper for FullWallets shipping data.
151 class FullWalletShippingWrapper : public DataModelWrapper { 164 class FullWalletShippingWrapper : public DataModelWrapper {
152 public: 165 public:
153 explicit FullWalletShippingWrapper(wallet::FullWallet* full_wallet); 166 explicit FullWalletShippingWrapper(wallet::FullWallet* full_wallet);
154 virtual ~FullWalletShippingWrapper(); 167 virtual ~FullWalletShippingWrapper();
155 168
156 virtual string16 GetInfo(AutofillFieldType type) OVERRIDE; 169 virtual string16 GetInfo(AutofillFieldType type) OVERRIDE;
157 170
158 private: 171 private:
159 wallet::FullWallet* full_wallet_; 172 wallet::FullWallet* full_wallet_;
173
174 DISALLOW_COPY_AND_ASSIGN(FullWalletShippingWrapper);
160 }; 175 };
161 176
162 } // namespace autofill 177 } // namespace autofill
163 178
164 #endif // CHROME_BROWSER_UI_AUTOFILL_DATA_MODEL_WRAPPER_H_ 179 #endif // CHROME_BROWSER_UI_AUTOFILL_DATA_MODEL_WRAPPER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698