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

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: ahutter@ review 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 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();
Evan Stade 2013/03/26 19:29:54 why
Dan Beam 2013/03/27 00:38:27 derived classes only found the private copy ctor,
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 private:
65 DISALLOW_COPY_AND_ASSIGN(DataModelWrapper);
62 }; 66 };
63 67
64 // A DataModelWrapper for Autofill data. 68 // A DataModelWrapper for Autofill data.
65 class AutofillFormGroupWrapper : public DataModelWrapper { 69 class AutofillFormGroupWrapper : public DataModelWrapper {
66 public: 70 public:
67 AutofillFormGroupWrapper(const FormGroup* form_group, size_t variant); 71 AutofillFormGroupWrapper(const FormGroup* form_group, size_t variant);
68 virtual ~AutofillFormGroupWrapper(); 72 virtual ~AutofillFormGroupWrapper();
69 73
70 virtual string16 GetInfo(AutofillFieldType type) OVERRIDE; 74 virtual string16 GetInfo(AutofillFieldType type) OVERRIDE;
71 75
72 protected: 76 protected:
73 virtual void FillFormField(AutofillField* field) OVERRIDE; 77 virtual void FillFormField(AutofillField* field) OVERRIDE;
74 78
75 size_t variant() const { return variant_; } 79 size_t variant() const { return variant_; }
76 80
77 private: 81 private:
78 const FormGroup* form_group_; 82 const FormGroup* form_group_;
79 const size_t variant_; 83 const size_t variant_;
84
85 DISALLOW_COPY_AND_ASSIGN(AutofillFormGroupWrapper);
80 }; 86 };
81 87
82 // A DataModelWrapper for Autofill profiles. 88 // A DataModelWrapper for Autofill profiles.
83 class AutofillProfileWrapper : public AutofillFormGroupWrapper { 89 class AutofillProfileWrapper : public AutofillFormGroupWrapper {
84 public: 90 public:
85 AutofillProfileWrapper(const AutofillProfile* profile, size_t variant); 91 AutofillProfileWrapper(const AutofillProfile* profile, size_t variant);
86 virtual ~AutofillProfileWrapper(); 92 virtual ~AutofillProfileWrapper();
87 93
88 virtual void FillInputs(DetailInputs* inputs) OVERRIDE; 94 virtual void FillInputs(DetailInputs* inputs) OVERRIDE;
89 95
90 private: 96 private:
91 const AutofillProfile* profile_; 97 const AutofillProfile* profile_;
98
99 DISALLOW_COPY_AND_ASSIGN(AutofillProfileWrapper);
92 }; 100 };
93 101
94 // A DataModelWrapper specifically for Autofill CreditCard data. 102 // A DataModelWrapper specifically for Autofill CreditCard data.
95 class AutofillCreditCardWrapper : public AutofillFormGroupWrapper { 103 class AutofillCreditCardWrapper : public AutofillFormGroupWrapper {
96 public: 104 public:
97 explicit AutofillCreditCardWrapper(const CreditCard* card); 105 explicit AutofillCreditCardWrapper(const CreditCard* card);
98 virtual ~AutofillCreditCardWrapper(); 106 virtual ~AutofillCreditCardWrapper();
99 107
100 virtual string16 GetInfo(AutofillFieldType type) OVERRIDE; 108 virtual string16 GetInfo(AutofillFieldType type) OVERRIDE;
101 virtual gfx::Image GetIcon() OVERRIDE; 109 virtual gfx::Image GetIcon() OVERRIDE;
102 virtual string16 GetDisplayText() OVERRIDE; 110 virtual string16 GetDisplayText() OVERRIDE;
103 111
104 protected: 112 protected:
105 virtual void FillFormField(AutofillField* field) OVERRIDE; 113 virtual void FillFormField(AutofillField* field) OVERRIDE;
106 114
107 private: 115 private:
108 const CreditCard* card_; 116 const CreditCard* card_;
117
118 DISALLOW_COPY_AND_ASSIGN(AutofillCreditCardWrapper);
109 }; 119 };
110 120
111 // A DataModelWrapper for Wallet addresses. 121 // A DataModelWrapper for Wallet addresses.
112 class WalletAddressWrapper : public DataModelWrapper { 122 class WalletAddressWrapper : public DataModelWrapper {
113 public: 123 public:
114 explicit WalletAddressWrapper(const wallet::Address* address); 124 explicit WalletAddressWrapper(const wallet::Address* address);
115 virtual ~WalletAddressWrapper(); 125 virtual ~WalletAddressWrapper();
116 126
117 virtual string16 GetInfo(AutofillFieldType type) OVERRIDE; 127 virtual string16 GetInfo(AutofillFieldType type) OVERRIDE;
118 128
119 private: 129 private:
120 const wallet::Address* address_; 130 const wallet::Address* address_;
131
132 DISALLOW_COPY_AND_ASSIGN(WalletAddressWrapper);
121 }; 133 };
122 134
123 // A DataModelWrapper for Wallet instruments. 135 // A DataModelWrapper for Wallet instruments.
124 class WalletInstrumentWrapper : public DataModelWrapper { 136 class WalletInstrumentWrapper : public DataModelWrapper {
125 public: 137 public:
126 explicit WalletInstrumentWrapper( 138 explicit WalletInstrumentWrapper(
127 const wallet::WalletItems::MaskedInstrument* instrument); 139 const wallet::WalletItems::MaskedInstrument* instrument);
128 virtual ~WalletInstrumentWrapper(); 140 virtual ~WalletInstrumentWrapper();
129 141
130 virtual string16 GetInfo(AutofillFieldType type) OVERRIDE; 142 virtual string16 GetInfo(AutofillFieldType type) OVERRIDE;
131 virtual gfx::Image GetIcon() OVERRIDE; 143 virtual gfx::Image GetIcon() OVERRIDE;
132 virtual string16 GetDisplayText() OVERRIDE; 144 virtual string16 GetDisplayText() OVERRIDE;
133 145
134 private: 146 private:
135 const wallet::WalletItems::MaskedInstrument* instrument_; 147 const wallet::WalletItems::MaskedInstrument* instrument_;
148
149 DISALLOW_COPY_AND_ASSIGN(WalletInstrumentWrapper);
136 }; 150 };
137 151
138 // A DataModelWrapper for FullWallets billing data. 152 // A DataModelWrapper for FullWallets billing data.
139 class FullWalletBillingWrapper : public DataModelWrapper { 153 class FullWalletBillingWrapper : public DataModelWrapper {
140 public: 154 public:
141 explicit FullWalletBillingWrapper(wallet::FullWallet* full_wallet); 155 explicit FullWalletBillingWrapper(wallet::FullWallet* full_wallet);
142 virtual ~FullWalletBillingWrapper(); 156 virtual ~FullWalletBillingWrapper();
143 157
144 virtual string16 GetInfo(AutofillFieldType type) OVERRIDE; 158 virtual string16 GetInfo(AutofillFieldType type) OVERRIDE;
145 159
146 private: 160 private:
147 wallet::FullWallet* full_wallet_; 161 wallet::FullWallet* full_wallet_;
162
163 DISALLOW_COPY_AND_ASSIGN(FullWalletBillingWrapper);
148 }; 164 };
149 165
150 // A DataModelWrapper for FullWallets shipping data. 166 // A DataModelWrapper for FullWallets shipping data.
151 class FullWalletShippingWrapper : public DataModelWrapper { 167 class FullWalletShippingWrapper : public DataModelWrapper {
152 public: 168 public:
153 explicit FullWalletShippingWrapper(wallet::FullWallet* full_wallet); 169 explicit FullWalletShippingWrapper(wallet::FullWallet* full_wallet);
154 virtual ~FullWalletShippingWrapper(); 170 virtual ~FullWalletShippingWrapper();
155 171
156 virtual string16 GetInfo(AutofillFieldType type) OVERRIDE; 172 virtual string16 GetInfo(AutofillFieldType type) OVERRIDE;
157 173
158 private: 174 private:
159 wallet::FullWallet* full_wallet_; 175 wallet::FullWallet* full_wallet_;
176
177 DISALLOW_COPY_AND_ASSIGN(FullWalletShippingWrapper);
160 }; 178 };
161 179
162 } // namespace autofill 180 } // namespace autofill
163 181
164 #endif // CHROME_BROWSER_UI_AUTOFILL_DATA_MODEL_WRAPPER_H_ 182 #endif // CHROME_BROWSER_UI_AUTOFILL_DATA_MODEL_WRAPPER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698