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

Side by Side Diff: components/autofill/core/browser/autofill_profile.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: Address comments. 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_PROFILE_H_ 5 #ifndef COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_PROFILE_H_
6 #define COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_PROFILE_H_ 6 #define COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_PROFILE_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include <iosfwd> 10 #include <iosfwd>
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 73
74 // Returns true if the |type| of data in this profile is present, but invalid. 74 // Returns true if the |type| of data in this profile is present, but invalid.
75 // Otherwise returns false. 75 // Otherwise returns false.
76 bool IsPresentButInvalid(ServerFieldType type) const; 76 bool IsPresentButInvalid(ServerFieldType type) const;
77 77
78 // Comparison for Sync. Returns 0 if the profile is the same as |this|, 78 // Comparison for Sync. Returns 0 if the profile is the same as |this|,
79 // or < 0, or > 0 if it is different. The implied ordering can be used for 79 // or < 0, or > 0 if it is different. The implied ordering can be used for
80 // culling duplicates. The ordering is based on collation order of the 80 // culling duplicates. The ordering is based on collation order of the
81 // textual contents of the fields. 81 // textual contents of the fields.
82 // GUIDs and origins are not compared, only the values of the contents 82 // GUIDs and origins are not compared, only the values of the contents
83 // themselves. Full profile comparision, comparison includes multi-valued 83 // themselves. Full profile comparison, comparison includes multi-valued
84 // fields. 84 // fields.
85 int Compare(const AutofillProfile& profile) const; 85 int Compare(const AutofillProfile& profile) const;
86 86
87 // Equality operators compare GUIDs, origins, and the contents in the 87 // Equality operators compare GUIDs, origins, and the contents in the
88 // comparison. 88 // comparison.
89 bool operator==(const AutofillProfile& profile) const; 89 bool operator==(const AutofillProfile& profile) const;
90 virtual bool operator!=(const AutofillProfile& profile) const; 90 virtual bool operator!=(const AutofillProfile& profile) const;
91 91
92 // Returns concatenation of full name and address line 1. This acts as the 92 // Returns concatenation of full name and address line 1. This acts as the
93 // basis of comparison for new values that are submitted through forms to 93 // basis of comparison for new values that are submitted through forms to
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 // and |excluded_field| is ignored; by convention, it should be of 125 // and |excluded_field| is ignored; by convention, it should be of
126 // |UNKNOWN_TYPE| when |suggested_fields| is NULL. Each label includes at 126 // |UNKNOWN_TYPE| when |suggested_fields| is NULL. Each label includes at
127 // least |minimal_fields_shown| fields, if possible. 127 // least |minimal_fields_shown| fields, if possible.
128 static void CreateInferredLabels( 128 static void CreateInferredLabels(
129 const std::vector<AutofillProfile*>& profiles, 129 const std::vector<AutofillProfile*>& profiles,
130 const std::vector<ServerFieldType>* suggested_fields, 130 const std::vector<ServerFieldType>* suggested_fields,
131 ServerFieldType excluded_field, 131 ServerFieldType excluded_field,
132 size_t minimal_fields_shown, 132 size_t minimal_fields_shown,
133 std::vector<base::string16>* labels); 133 std::vector<base::string16>* labels);
134 134
135 const std::string& language_code() const { return language_code_; }
136 void set_language_code(const std::string& language_code) {
137 language_code_ = language_code;
138 }
139
135 private: 140 private:
136 typedef std::vector<const FormGroup*> FormGroupList; 141 typedef std::vector<const FormGroup*> FormGroupList;
137 142
138 // FormGroup: 143 // FormGroup:
139 virtual void GetSupportedTypes( 144 virtual void GetSupportedTypes(
140 ServerFieldTypeSet* supported_types) const OVERRIDE; 145 ServerFieldTypeSet* supported_types) const OVERRIDE;
141 146
142 // Shared implementation for GetRawMultiInfo() and GetMultiInfo(). Pass an 147 // Shared implementation for GetRawMultiInfo() and GetMultiInfo(). Pass an
143 // empty |app_locale| to get the raw info; otherwise, the returned info is 148 // empty |app_locale| to get the raw info; otherwise, the returned info is
144 // canonicalized according to the given |app_locale|, if appropriate. 149 // canonicalized according to the given |app_locale|, if appropriate.
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 FormGroupList FormGroups() const; 183 FormGroupList FormGroups() const;
179 const FormGroup* FormGroupForType(const AutofillType& type) const; 184 const FormGroup* FormGroupForType(const AutofillType& type) const;
180 FormGroup* MutableFormGroupForType(const AutofillType& type); 185 FormGroup* MutableFormGroupForType(const AutofillType& type);
181 186
182 // Personal information for this profile. 187 // Personal information for this profile.
183 std::vector<NameInfo> name_; 188 std::vector<NameInfo> name_;
184 std::vector<EmailInfo> email_; 189 std::vector<EmailInfo> email_;
185 CompanyInfo company_; 190 CompanyInfo company_;
186 std::vector<PhoneNumber> phone_number_; 191 std::vector<PhoneNumber> phone_number_;
187 Address address_; 192 Address address_;
193
194 // The BCP 47 language code that can be used to format |address_| for display.
195 std::string language_code_;
188 }; 196 };
189 197
190 // So we can compare AutofillProfiles with EXPECT_EQ(). 198 // So we can compare AutofillProfiles with EXPECT_EQ().
191 std::ostream& operator<<(std::ostream& os, const AutofillProfile& profile); 199 std::ostream& operator<<(std::ostream& os, const AutofillProfile& profile);
192 200
193 } // namespace autofill 201 } // namespace autofill
194 202
195 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_PROFILE_H_ 203 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_PROFILE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698