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

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

Issue 24538008: rAc: phone number cleanup (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fixme Created 7 years, 2 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/strings/string16.h" 9 #include "base/strings/string16.h"
10 #include "chrome/browser/ui/autofill/autofill_dialog_types.h" 10 #include "chrome/browser/ui/autofill/autofill_dialog_types.h"
(...skipping 21 matching lines...) Expand all
32 // regardless of their type. Implementations are intended to be lightweight and 32 // regardless of their type. Implementations are intended to be lightweight and
33 // copyable, only holding weak references to their backing model. 33 // copyable, only holding weak references to their backing model.
34 class DataModelWrapper { 34 class DataModelWrapper {
35 public: 35 public:
36 virtual ~DataModelWrapper(); 36 virtual ~DataModelWrapper();
37 37
38 // Fills in |inputs| with the data that this model contains (|inputs| is an 38 // Fills in |inputs| with the data that this model contains (|inputs| is an
39 // out-param). 39 // out-param).
40 void FillInputs(DetailInputs* inputs); 40 void FillInputs(DetailInputs* inputs);
41 41
42 // Returns the data for a specific autocomplete type. 42 // Returns the data for a specific autocomplete type in a format for filling
43 // into a web form.
43 virtual base::string16 GetInfo(const AutofillType& type) const = 0; 44 virtual base::string16 GetInfo(const AutofillType& type) const = 0;
44 45
46 // Returns the data for a specified type in a format optimized for displaying
47 // to the user.
48 virtual base::string16 GetInfoForDisplay(const AutofillType& type) const;
49
45 // Returns the icon, if any, that represents this model. 50 // Returns the icon, if any, that represents this model.
46 virtual gfx::Image GetIcon(); 51 virtual gfx::Image GetIcon();
47 52
48 // Gets text to display to the user to summarize this data source. The 53 // Gets text to display to the user to summarize this data source. The
49 // default implementation assumes this is an address. Both params are required 54 // default implementation assumes this is an address. Both params are required
50 // to be non-NULL and will be filled in with text that is vertically compact 55 // to be non-NULL and will be filled in with text that is vertically compact
51 // (but may take up a lot of horizontal space) and horizontally compact (but 56 // (but may take up a lot of horizontal space) and horizontally compact (but
52 // may take up a lot of vertical space) respectively. The return value will 57 // may take up a lot of vertical space) respectively. The return value will
53 // be true and the outparams will be filled in only if the data represented is 58 // be true and the outparams will be filled in only if the data represented is
54 // complete and valid. 59 // complete and valid.
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 // A DataModelWrapper for Autofill profiles. 101 // A DataModelWrapper for Autofill profiles.
97 class AutofillProfileWrapper : public DataModelWrapper { 102 class AutofillProfileWrapper : public DataModelWrapper {
98 public: 103 public:
99 explicit AutofillProfileWrapper(const AutofillProfile* profile); 104 explicit AutofillProfileWrapper(const AutofillProfile* profile);
100 AutofillProfileWrapper(const AutofillProfile* profile, 105 AutofillProfileWrapper(const AutofillProfile* profile,
101 const AutofillType& variant_type, 106 const AutofillType& variant_type,
102 size_t variant); 107 size_t variant);
103 virtual ~AutofillProfileWrapper(); 108 virtual ~AutofillProfileWrapper();
104 109
105 virtual base::string16 GetInfo(const AutofillType& type) const OVERRIDE; 110 virtual base::string16 GetInfo(const AutofillType& type) const OVERRIDE;
111 virtual base::string16 GetInfoForDisplay(const AutofillType& type) const
112 OVERRIDE;
106 113
107 protected: 114 protected:
108 virtual void FillFormField(AutofillField* field) const OVERRIDE; 115 virtual void FillFormField(AutofillField* field) const OVERRIDE;
109 116
110 // Returns the variant that should be used when dealing with an element that 117 // Returns the variant that should be used when dealing with an element that
111 // has the given |type|. 118 // has the given |type|.
112 size_t GetVariantForType(const AutofillType& type) const; 119 size_t GetVariantForType(const AutofillType& type) const;
113 120
114 private: 121 private:
115 const AutofillProfile* profile_; 122 const AutofillProfile* profile_;
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 DISALLOW_COPY_AND_ASSIGN(AutofillCreditCardWrapper); 160 DISALLOW_COPY_AND_ASSIGN(AutofillCreditCardWrapper);
154 }; 161 };
155 162
156 // A DataModelWrapper for Wallet addresses. 163 // A DataModelWrapper for Wallet addresses.
157 class WalletAddressWrapper : public DataModelWrapper { 164 class WalletAddressWrapper : public DataModelWrapper {
158 public: 165 public:
159 explicit WalletAddressWrapper(const wallet::Address* address); 166 explicit WalletAddressWrapper(const wallet::Address* address);
160 virtual ~WalletAddressWrapper(); 167 virtual ~WalletAddressWrapper();
161 168
162 virtual base::string16 GetInfo(const AutofillType& type) const OVERRIDE; 169 virtual base::string16 GetInfo(const AutofillType& type) const OVERRIDE;
170 virtual base::string16 GetInfoForDisplay(const AutofillType& type) const
171 OVERRIDE;
163 virtual bool GetDisplayText(base::string16* vertically_compact, 172 virtual bool GetDisplayText(base::string16* vertically_compact,
164 base::string16* horizontally_compact) OVERRIDE; 173 base::string16* horizontally_compact) OVERRIDE;
165 174
166 private: 175 private:
167 const wallet::Address* address_; 176 const wallet::Address* address_;
168 177
169 DISALLOW_COPY_AND_ASSIGN(WalletAddressWrapper); 178 DISALLOW_COPY_AND_ASSIGN(WalletAddressWrapper);
170 }; 179 };
171 180
172 // A DataModelWrapper for Wallet instruments. 181 // A DataModelWrapper for Wallet instruments.
173 class WalletInstrumentWrapper : public DataModelWrapper { 182 class WalletInstrumentWrapper : public DataModelWrapper {
174 public: 183 public:
175 explicit WalletInstrumentWrapper( 184 explicit WalletInstrumentWrapper(
176 const wallet::WalletItems::MaskedInstrument* instrument); 185 const wallet::WalletItems::MaskedInstrument* instrument);
177 virtual ~WalletInstrumentWrapper(); 186 virtual ~WalletInstrumentWrapper();
178 187
179 virtual base::string16 GetInfo(const AutofillType& type) const OVERRIDE; 188 virtual base::string16 GetInfo(const AutofillType& type) const OVERRIDE;
189 virtual base::string16 GetInfoForDisplay(const AutofillType& type) const
190 OVERRIDE;
180 virtual gfx::Image GetIcon() OVERRIDE; 191 virtual gfx::Image GetIcon() OVERRIDE;
181 virtual bool GetDisplayText(base::string16* vertically_compact, 192 virtual bool GetDisplayText(base::string16* vertically_compact,
182 base::string16* horizontally_compact) OVERRIDE; 193 base::string16* horizontally_compact) OVERRIDE;
183 194
184 private: 195 private:
185 const wallet::WalletItems::MaskedInstrument* instrument_; 196 const wallet::WalletItems::MaskedInstrument* instrument_;
186 197
187 DISALLOW_COPY_AND_ASSIGN(WalletInstrumentWrapper); 198 DISALLOW_COPY_AND_ASSIGN(WalletInstrumentWrapper);
188 }; 199 };
189 200
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 238
228 private: 239 private:
229 const DetailOutputMap& outputs_; 240 const DetailOutputMap& outputs_;
230 241
231 DISALLOW_COPY_AND_ASSIGN(DetailOutputWrapper); 242 DISALLOW_COPY_AND_ASSIGN(DetailOutputWrapper);
232 }; 243 };
233 244
234 } // namespace autofill 245 } // namespace autofill
235 246
236 #endif // CHROME_BROWSER_UI_AUTOFILL_DATA_MODEL_WRAPPER_H_ 247 #endif // CHROME_BROWSER_UI_AUTOFILL_DATA_MODEL_WRAPPER_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/autofill/data_model_wrapper.cc » ('j') | chrome/browser/ui/autofill/data_model_wrapper.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698