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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 DataModelWrapper(); | 87 DataModelWrapper(); |
88 | 88 |
89 private: | 89 private: |
90 DISALLOW_COPY_AND_ASSIGN(DataModelWrapper); | 90 DISALLOW_COPY_AND_ASSIGN(DataModelWrapper); |
91 }; | 91 }; |
92 | 92 |
93 // A DataModelWrapper for Autofill profiles. | 93 // A DataModelWrapper for Autofill profiles. |
94 class AutofillProfileWrapper : public DataModelWrapper { | 94 class AutofillProfileWrapper : public DataModelWrapper { |
95 public: | 95 public: |
96 explicit AutofillProfileWrapper(const AutofillProfile* profile); | 96 explicit AutofillProfileWrapper(const AutofillProfile* profile); |
97 AutofillProfileWrapper(const AutofillProfile* profile, | |
98 const AutofillType& variant_type, | |
99 size_t variant); | |
100 ~AutofillProfileWrapper() override; | 97 ~AutofillProfileWrapper() override; |
101 | 98 |
102 base::string16 GetInfo(const AutofillType& type) const override; | 99 base::string16 GetInfo(const AutofillType& type) const override; |
103 base::string16 GetInfoForDisplay(const AutofillType& type) const override; | 100 base::string16 GetInfoForDisplay(const AutofillType& type) const override; |
104 const std::string& GetLanguageCode() const override; | 101 const std::string& GetLanguageCode() const override; |
105 | 102 |
106 protected: | |
107 // Returns the variant that should be used when dealing with an element that | |
108 // has the given |type|. | |
109 size_t GetVariantForType(const AutofillType& type) const; | |
110 | |
111 private: | 103 private: |
112 const AutofillProfile* profile_; | 104 const AutofillProfile* profile_; |
113 | 105 |
114 // The profile variant. |variant_| describes which variant of |variant_group_| | |
115 // to use in the profile. | |
116 FieldTypeGroup variant_group_; | |
117 size_t variant_; | |
118 | |
119 DISALLOW_COPY_AND_ASSIGN(AutofillProfileWrapper); | 106 DISALLOW_COPY_AND_ASSIGN(AutofillProfileWrapper); |
120 }; | 107 }; |
121 | 108 |
122 // A DataModelWrapper specifically for shipping address profiles. | 109 // A DataModelWrapper specifically for shipping address profiles. |
123 class AutofillShippingAddressWrapper : public AutofillProfileWrapper { | 110 class AutofillShippingAddressWrapper : public AutofillProfileWrapper { |
124 public: | 111 public: |
125 explicit AutofillShippingAddressWrapper(const AutofillProfile* profile); | 112 explicit AutofillShippingAddressWrapper(const AutofillProfile* profile); |
126 ~AutofillShippingAddressWrapper() override; | 113 ~AutofillShippingAddressWrapper() override; |
127 | 114 |
128 base::string16 GetInfo(const AutofillType& type) const override; | 115 base::string16 GetInfo(const AutofillType& type) const override; |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
231 | 218 |
232 private: | 219 private: |
233 const ::i18n::addressinput::AddressData* address_; | 220 const ::i18n::addressinput::AddressData* address_; |
234 | 221 |
235 DISALLOW_COPY_AND_ASSIGN(I18nAddressDataWrapper); | 222 DISALLOW_COPY_AND_ASSIGN(I18nAddressDataWrapper); |
236 }; | 223 }; |
237 | 224 |
238 } // namespace autofill | 225 } // namespace autofill |
239 | 226 |
240 #endif // CHROME_BROWSER_UI_AUTOFILL_DATA_MODEL_WRAPPER_H_ | 227 #endif // CHROME_BROWSER_UI_AUTOFILL_DATA_MODEL_WRAPPER_H_ |
OLD | NEW |