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