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

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

Issue 212873003: Store the language code for the address in autofill profile. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixups Created 6 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 <vector> 8 #include <vector>
9 9
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 // Gets text to display to the user to summarize this data source. The 62 // Gets text to display to the user to summarize this data source. The
63 // default implementation assumes this is an address. Both params are required 63 // default implementation assumes this is an address. Both params are required
64 // to be non-NULL and will be filled in with text that is vertically compact 64 // to be non-NULL and will be filled in with text that is vertically compact
65 // (but may take up a lot of horizontal space) and horizontally compact (but 65 // (but may take up a lot of horizontal space) and horizontally compact (but
66 // may take up a lot of vertical space) respectively. The return value will 66 // may take up a lot of vertical space) respectively. The return value will
67 // be true and the outparams will be filled in only if the data represented is 67 // be true and the outparams will be filled in only if the data represented is
68 // complete and valid. 68 // complete and valid.
69 virtual bool GetDisplayText(base::string16* vertically_compact, 69 virtual bool GetDisplayText(base::string16* vertically_compact,
70 base::string16* horizontally_compact); 70 base::string16* horizontally_compact);
71 71
72 // Returns the BCP 47 language code that should be used for formatting the
73 // data for display. The default implementation returns the current browser
74 // locale.
75 virtual const std::string& GetLanguageCode() const;
76
72 // Fills in |form_structure| with the data that this model contains. |inputs| 77 // Fills in |form_structure| with the data that this model contains. |inputs|
73 // and |comparator| are used to determine whether each field in the 78 // and |comparator| are used to determine whether each field in the
74 // FormStructure should be filled in or left alone. Returns whether any fields 79 // FormStructure should be filled in or left alone. Returns whether any fields
75 // in |form_structure| were found to be matching. 80 // in |form_structure| were found to be matching.
76 bool FillFormStructure( 81 bool FillFormStructure(
77 const std::vector<ServerFieldType>& types, 82 const std::vector<ServerFieldType>& types,
78 const FormStructure::InputFieldComparator& compare, 83 const FormStructure::InputFieldComparator& compare,
79 FormStructure* form_structure) const; 84 FormStructure* form_structure) const;
80 85
81 protected: 86 protected:
82 DataModelWrapper(); 87 DataModelWrapper();
83 88
84 private: 89 private:
85 DISALLOW_COPY_AND_ASSIGN(DataModelWrapper); 90 DISALLOW_COPY_AND_ASSIGN(DataModelWrapper);
86 }; 91 };
87 92
88 // A DataModelWrapper for Autofill profiles. 93 // A DataModelWrapper for Autofill profiles.
89 class AutofillProfileWrapper : public DataModelWrapper { 94 class AutofillProfileWrapper : public DataModelWrapper {
90 public: 95 public:
91 explicit AutofillProfileWrapper(const AutofillProfile* profile); 96 explicit AutofillProfileWrapper(const AutofillProfile* profile);
92 AutofillProfileWrapper(const AutofillProfile* profile, 97 AutofillProfileWrapper(const AutofillProfile* profile,
93 const AutofillType& variant_type, 98 const AutofillType& variant_type,
94 size_t variant); 99 size_t variant);
95 virtual ~AutofillProfileWrapper(); 100 virtual ~AutofillProfileWrapper();
96 101
97 virtual base::string16 GetInfo(const AutofillType& type) const OVERRIDE; 102 virtual base::string16 GetInfo(const AutofillType& type) const OVERRIDE;
98 virtual base::string16 GetInfoForDisplay(const AutofillType& type) const 103 virtual base::string16 GetInfoForDisplay(const AutofillType& type) const
99 OVERRIDE; 104 OVERRIDE;
105 virtual const std::string& GetLanguageCode() const OVERRIDE;
100 106
101 protected: 107 protected:
102 // Returns the variant that should be used when dealing with an element that 108 // Returns the variant that should be used when dealing with an element that
103 // has the given |type|. 109 // has the given |type|.
104 size_t GetVariantForType(const AutofillType& type) const; 110 size_t GetVariantForType(const AutofillType& type) const;
105 111
106 private: 112 private:
107 const AutofillProfile* profile_; 113 const AutofillProfile* profile_;
108 114
109 // The profile variant. |variant_| describes which variant of |variant_group_| 115 // The profile variant. |variant_| describes which variant of |variant_group_|
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 }; 218 };
213 219
214 // A DataModelWrapper for ::i18n::addressinput::AddressData objects. 220 // A DataModelWrapper for ::i18n::addressinput::AddressData objects.
215 class I18nAddressDataWrapper : public DataModelWrapper { 221 class I18nAddressDataWrapper : public DataModelWrapper {
216 public: 222 public:
217 explicit I18nAddressDataWrapper( 223 explicit I18nAddressDataWrapper(
218 const ::i18n::addressinput::AddressData* address); 224 const ::i18n::addressinput::AddressData* address);
219 virtual ~I18nAddressDataWrapper(); 225 virtual ~I18nAddressDataWrapper();
220 226
221 virtual base::string16 GetInfo(const AutofillType& type) const OVERRIDE; 227 virtual base::string16 GetInfo(const AutofillType& type) const OVERRIDE;
228 virtual const std::string& GetLanguageCode() const OVERRIDE;
222 229
223 private: 230 private:
224 const ::i18n::addressinput::AddressData* address_; 231 const ::i18n::addressinput::AddressData* address_;
225 232
226 DISALLOW_COPY_AND_ASSIGN(I18nAddressDataWrapper); 233 DISALLOW_COPY_AND_ASSIGN(I18nAddressDataWrapper);
227 }; 234 };
228 235
229 } // namespace autofill 236 } // namespace autofill
230 237
231 #endif // CHROME_BROWSER_UI_AUTOFILL_DATA_MODEL_WRAPPER_H_ 238 #endif // CHROME_BROWSER_UI_AUTOFILL_DATA_MODEL_WRAPPER_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/autofill/autofill_dialog_i18n_input_unittest.cc ('k') | chrome/browser/ui/autofill/data_model_wrapper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698