OLD | NEW |
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 <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 DISALLOW_COPY_AND_ASSIGN(DataModelWrapper); | 89 DISALLOW_COPY_AND_ASSIGN(DataModelWrapper); |
90 }; | 90 }; |
91 | 91 |
92 // A DataModelWrapper for Autofill profiles. | 92 // A DataModelWrapper for Autofill profiles. |
93 class AutofillProfileWrapper : public DataModelWrapper { | 93 class AutofillProfileWrapper : public DataModelWrapper { |
94 public: | 94 public: |
95 explicit AutofillProfileWrapper(const AutofillProfile* profile); | 95 explicit AutofillProfileWrapper(const AutofillProfile* profile); |
96 AutofillProfileWrapper(const AutofillProfile* profile, | 96 AutofillProfileWrapper(const AutofillProfile* profile, |
97 const AutofillType& variant_type, | 97 const AutofillType& variant_type, |
98 size_t variant); | 98 size_t variant); |
99 virtual ~AutofillProfileWrapper(); | 99 ~AutofillProfileWrapper() override; |
100 | 100 |
101 virtual base::string16 GetInfo(const AutofillType& type) const override; | 101 base::string16 GetInfo(const AutofillType& type) const override; |
102 virtual base::string16 GetInfoForDisplay(const AutofillType& type) const | 102 base::string16 GetInfoForDisplay(const AutofillType& type) const override; |
103 override; | 103 const std::string& GetLanguageCode() const override; |
104 virtual const std::string& GetLanguageCode() const override; | |
105 | 104 |
106 protected: | 105 protected: |
107 // Returns the variant that should be used when dealing with an element that | 106 // Returns the variant that should be used when dealing with an element that |
108 // has the given |type|. | 107 // has the given |type|. |
109 size_t GetVariantForType(const AutofillType& type) const; | 108 size_t GetVariantForType(const AutofillType& type) const; |
110 | 109 |
111 private: | 110 private: |
112 const AutofillProfile* profile_; | 111 const AutofillProfile* profile_; |
113 | 112 |
114 // The profile variant. |variant_| describes which variant of |variant_group_| | 113 // The profile variant. |variant_| describes which variant of |variant_group_| |
115 // to use in the profile. | 114 // to use in the profile. |
116 FieldTypeGroup variant_group_; | 115 FieldTypeGroup variant_group_; |
117 size_t variant_; | 116 size_t variant_; |
118 | 117 |
119 DISALLOW_COPY_AND_ASSIGN(AutofillProfileWrapper); | 118 DISALLOW_COPY_AND_ASSIGN(AutofillProfileWrapper); |
120 }; | 119 }; |
121 | 120 |
122 // A DataModelWrapper specifically for shipping address profiles. | 121 // A DataModelWrapper specifically for shipping address profiles. |
123 class AutofillShippingAddressWrapper : public AutofillProfileWrapper { | 122 class AutofillShippingAddressWrapper : public AutofillProfileWrapper { |
124 public: | 123 public: |
125 explicit AutofillShippingAddressWrapper(const AutofillProfile* profile); | 124 explicit AutofillShippingAddressWrapper(const AutofillProfile* profile); |
126 virtual ~AutofillShippingAddressWrapper(); | 125 ~AutofillShippingAddressWrapper() override; |
127 | 126 |
128 virtual base::string16 GetInfo(const AutofillType& type) const override; | 127 base::string16 GetInfo(const AutofillType& type) const override; |
129 | 128 |
130 private: | 129 private: |
131 DISALLOW_COPY_AND_ASSIGN(AutofillShippingAddressWrapper); | 130 DISALLOW_COPY_AND_ASSIGN(AutofillShippingAddressWrapper); |
132 }; | 131 }; |
133 | 132 |
134 // A DataModelWrapper specifically for Autofill CreditCard data. | 133 // A DataModelWrapper specifically for Autofill CreditCard data. |
135 class AutofillCreditCardWrapper : public DataModelWrapper { | 134 class AutofillCreditCardWrapper : public DataModelWrapper { |
136 public: | 135 public: |
137 explicit AutofillCreditCardWrapper(const CreditCard* card); | 136 explicit AutofillCreditCardWrapper(const CreditCard* card); |
138 virtual ~AutofillCreditCardWrapper(); | 137 ~AutofillCreditCardWrapper() override; |
139 | 138 |
140 virtual base::string16 GetInfo(const AutofillType& type) const override; | 139 base::string16 GetInfo(const AutofillType& type) const override; |
141 virtual gfx::Image GetIcon() override; | 140 gfx::Image GetIcon() override; |
142 virtual bool GetDisplayText(base::string16* vertically_compact, | 141 bool GetDisplayText(base::string16* vertically_compact, |
143 base::string16* horizontally_compact) override; | 142 base::string16* horizontally_compact) override; |
144 virtual const std::string& GetLanguageCode() const override; | 143 const std::string& GetLanguageCode() const override; |
145 | 144 |
146 private: | 145 private: |
147 const CreditCard* card_; | 146 const CreditCard* card_; |
148 | 147 |
149 DISALLOW_COPY_AND_ASSIGN(AutofillCreditCardWrapper); | 148 DISALLOW_COPY_AND_ASSIGN(AutofillCreditCardWrapper); |
150 }; | 149 }; |
151 | 150 |
152 // A DataModelWrapper for Wallet addresses. | 151 // A DataModelWrapper for Wallet addresses. |
153 class WalletAddressWrapper : public DataModelWrapper { | 152 class WalletAddressWrapper : public DataModelWrapper { |
154 public: | 153 public: |
155 explicit WalletAddressWrapper(const wallet::Address* address); | 154 explicit WalletAddressWrapper(const wallet::Address* address); |
156 virtual ~WalletAddressWrapper(); | 155 ~WalletAddressWrapper() override; |
157 | 156 |
158 virtual base::string16 GetInfo(const AutofillType& type) const override; | 157 base::string16 GetInfo(const AutofillType& type) const override; |
159 virtual base::string16 GetInfoForDisplay(const AutofillType& type) const | 158 base::string16 GetInfoForDisplay(const AutofillType& type) const override; |
160 override; | 159 bool GetDisplayText(base::string16* vertically_compact, |
161 virtual bool GetDisplayText(base::string16* vertically_compact, | 160 base::string16* horizontally_compact) override; |
162 base::string16* horizontally_compact) override; | 161 const std::string& GetLanguageCode() const override; |
163 virtual const std::string& GetLanguageCode() const override; | |
164 | 162 |
165 private: | 163 private: |
166 const wallet::Address* address_; | 164 const wallet::Address* address_; |
167 | 165 |
168 DISALLOW_COPY_AND_ASSIGN(WalletAddressWrapper); | 166 DISALLOW_COPY_AND_ASSIGN(WalletAddressWrapper); |
169 }; | 167 }; |
170 | 168 |
171 // A DataModelWrapper for Wallet instruments. | 169 // A DataModelWrapper for Wallet instruments. |
172 class WalletInstrumentWrapper : public DataModelWrapper { | 170 class WalletInstrumentWrapper : public DataModelWrapper { |
173 public: | 171 public: |
174 explicit WalletInstrumentWrapper( | 172 explicit WalletInstrumentWrapper( |
175 const wallet::WalletItems::MaskedInstrument* instrument); | 173 const wallet::WalletItems::MaskedInstrument* instrument); |
176 virtual ~WalletInstrumentWrapper(); | 174 ~WalletInstrumentWrapper() override; |
177 | 175 |
178 virtual base::string16 GetInfo(const AutofillType& type) const override; | 176 base::string16 GetInfo(const AutofillType& type) const override; |
179 virtual base::string16 GetInfoForDisplay(const AutofillType& type) const | 177 base::string16 GetInfoForDisplay(const AutofillType& type) const override; |
180 override; | 178 gfx::Image GetIcon() override; |
181 virtual gfx::Image GetIcon() override; | 179 bool GetDisplayText(base::string16* vertically_compact, |
182 virtual bool GetDisplayText(base::string16* vertically_compact, | 180 base::string16* horizontally_compact) override; |
183 base::string16* horizontally_compact) override; | 181 const std::string& GetLanguageCode() const override; |
184 virtual const std::string& GetLanguageCode() const override; | |
185 | 182 |
186 private: | 183 private: |
187 const wallet::WalletItems::MaskedInstrument* instrument_; | 184 const wallet::WalletItems::MaskedInstrument* instrument_; |
188 | 185 |
189 DISALLOW_COPY_AND_ASSIGN(WalletInstrumentWrapper); | 186 DISALLOW_COPY_AND_ASSIGN(WalletInstrumentWrapper); |
190 }; | 187 }; |
191 | 188 |
192 // A DataModelWrapper for FullWallet billing data. | 189 // A DataModelWrapper for FullWallet billing data. |
193 class FullWalletBillingWrapper : public DataModelWrapper { | 190 class FullWalletBillingWrapper : public DataModelWrapper { |
194 public: | 191 public: |
195 explicit FullWalletBillingWrapper(wallet::FullWallet* full_wallet); | 192 explicit FullWalletBillingWrapper(wallet::FullWallet* full_wallet); |
196 virtual ~FullWalletBillingWrapper(); | 193 ~FullWalletBillingWrapper() override; |
197 | 194 |
198 virtual base::string16 GetInfo(const AutofillType& type) const override; | 195 base::string16 GetInfo(const AutofillType& type) const override; |
199 virtual bool GetDisplayText(base::string16* vertically_compact, | 196 bool GetDisplayText(base::string16* vertically_compact, |
200 base::string16* horizontally_compact) override; | 197 base::string16* horizontally_compact) override; |
201 virtual const std::string& GetLanguageCode() const override; | 198 const std::string& GetLanguageCode() const override; |
202 | 199 |
203 private: | 200 private: |
204 wallet::FullWallet* full_wallet_; | 201 wallet::FullWallet* full_wallet_; |
205 | 202 |
206 DISALLOW_COPY_AND_ASSIGN(FullWalletBillingWrapper); | 203 DISALLOW_COPY_AND_ASSIGN(FullWalletBillingWrapper); |
207 }; | 204 }; |
208 | 205 |
209 // A DataModelWrapper for FullWallet shipping data. | 206 // A DataModelWrapper for FullWallet shipping data. |
210 class FullWalletShippingWrapper : public DataModelWrapper { | 207 class FullWalletShippingWrapper : public DataModelWrapper { |
211 public: | 208 public: |
212 explicit FullWalletShippingWrapper(wallet::FullWallet* full_wallet); | 209 explicit FullWalletShippingWrapper(wallet::FullWallet* full_wallet); |
213 virtual ~FullWalletShippingWrapper(); | 210 ~FullWalletShippingWrapper() override; |
214 | 211 |
215 virtual base::string16 GetInfo(const AutofillType& type) const override; | 212 base::string16 GetInfo(const AutofillType& type) const override; |
216 virtual const std::string& GetLanguageCode() const override; | 213 const std::string& GetLanguageCode() const override; |
217 | 214 |
218 private: | 215 private: |
219 wallet::FullWallet* full_wallet_; | 216 wallet::FullWallet* full_wallet_; |
220 | 217 |
221 DISALLOW_COPY_AND_ASSIGN(FullWalletShippingWrapper); | 218 DISALLOW_COPY_AND_ASSIGN(FullWalletShippingWrapper); |
222 }; | 219 }; |
223 | 220 |
224 // A DataModelWrapper for ::i18n::addressinput::AddressData objects. | 221 // A DataModelWrapper for ::i18n::addressinput::AddressData objects. |
225 class I18nAddressDataWrapper : public DataModelWrapper { | 222 class I18nAddressDataWrapper : public DataModelWrapper { |
226 public: | 223 public: |
227 explicit I18nAddressDataWrapper( | 224 explicit I18nAddressDataWrapper( |
228 const ::i18n::addressinput::AddressData* address); | 225 const ::i18n::addressinput::AddressData* address); |
229 virtual ~I18nAddressDataWrapper(); | 226 ~I18nAddressDataWrapper() override; |
230 | 227 |
231 virtual base::string16 GetInfo(const AutofillType& type) const override; | 228 base::string16 GetInfo(const AutofillType& type) const override; |
232 virtual const std::string& GetLanguageCode() const override; | 229 const std::string& GetLanguageCode() const override; |
233 | 230 |
234 private: | 231 private: |
235 const ::i18n::addressinput::AddressData* address_; | 232 const ::i18n::addressinput::AddressData* address_; |
236 | 233 |
237 DISALLOW_COPY_AND_ASSIGN(I18nAddressDataWrapper); | 234 DISALLOW_COPY_AND_ASSIGN(I18nAddressDataWrapper); |
238 }; | 235 }; |
239 | 236 |
240 } // namespace autofill | 237 } // namespace autofill |
241 | 238 |
242 #endif // CHROME_BROWSER_UI_AUTOFILL_DATA_MODEL_WRAPPER_H_ | 239 #endif // CHROME_BROWSER_UI_AUTOFILL_DATA_MODEL_WRAPPER_H_ |
OLD | NEW |