OLD | NEW |
---|---|
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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
67 | 67 |
68 // How this card is stored. | 68 // How this card is stored. |
69 RecordType record_type() const { return record_type_; } | 69 RecordType record_type() const { return record_type_; } |
70 void set_record_type(RecordType type) { record_type_ = type; } | 70 void set_record_type(RecordType type) { record_type_ = type; } |
71 | 71 |
72 // Multi-value equivalents to |GetInfo| and |SetInfo|. | 72 // Multi-value equivalents to |GetInfo| and |SetInfo|. |
73 void SetRawMultiInfo(ServerFieldType type, | 73 void SetRawMultiInfo(ServerFieldType type, |
74 const std::vector<base::string16>& values); | 74 const std::vector<base::string16>& values); |
75 void GetRawMultiInfo(ServerFieldType type, | 75 void GetRawMultiInfo(ServerFieldType type, |
76 std::vector<base::string16>* values) const; | 76 std::vector<base::string16>* values) const; |
77 void GetMultiInfo(const AutofillType& type, | |
78 const std::string& app_locale, | |
79 std::vector<base::string16>* values) const; | |
80 | 77 |
81 // Returns true if there are no values (field types) set. | 78 // Returns true if there are no values (field types) set. |
82 bool IsEmpty(const std::string& app_locale) const; | 79 bool IsEmpty(const std::string& app_locale) const; |
83 | 80 |
84 // Returns true if the |type| of data in this profile is present, but invalid. | 81 // Returns true if the |type| of data in this profile is present, but invalid. |
85 // Otherwise returns false. | 82 // Otherwise returns false. |
86 bool IsPresentButInvalid(ServerFieldType type) const; | 83 bool IsPresentButInvalid(ServerFieldType type) const; |
87 | 84 |
88 // Comparison for Sync. Returns 0 if the profile is the same as |this|, | 85 // Comparison for Sync. Returns 0 if the profile is the same as |this|, |
89 // or < 0, or > 0 if it is different. The implied ordering can be used for | 86 // or < 0, or > 0 if it is different. The implied ordering can be used for |
(...skipping 26 matching lines...) Expand all Loading... | |
116 // Returns true if the data in this AutofillProfile is a subset of the data in | 113 // Returns true if the data in this AutofillProfile is a subset of the data in |
117 // |profile|. | 114 // |profile|. |
118 bool IsSubsetOf(const AutofillProfile& profile, | 115 bool IsSubsetOf(const AutofillProfile& profile, |
119 const std::string& app_locale) const; | 116 const std::string& app_locale) const; |
120 | 117 |
121 // Like IsSubsetOf, but only considers the types present in |types|. | 118 // Like IsSubsetOf, but only considers the types present in |types|. |
122 bool IsSubsetOfForFieldSet(const AutofillProfile& profile, | 119 bool IsSubsetOfForFieldSet(const AutofillProfile& profile, |
123 const std::string& app_locale, | 120 const std::string& app_locale, |
124 const ServerFieldTypeSet& types) const; | 121 const ServerFieldTypeSet& types) const; |
125 | 122 |
126 // Overwrites the single-valued field data in |profile| with this | 123 // Overwrites the field data in |profile| with this Profile. |
127 // Profile. Or, for multi-valued fields append the new values. | 124 void OverwriteWith(const AutofillProfile& profile, |
128 void OverwriteWithOrAddTo(const AutofillProfile& profile, | 125 const std::string& app_locale); |
129 const std::string& app_locale); | 126 |
127 // Saves info from |profile| into |this|, provided |this| and |profile| do not | |
128 // have any direct conflicts (i.e. data is present but different). Will not | |
129 // make changes if |this| is verified and |profile| is not. Returns true if | |
130 // |this| and |profile| are similar. | |
131 bool SaveAdditionalInfo(const AutofillProfile& profile, | |
132 const std::string& app_locale); | |
130 | 133 |
131 // Returns |true| if |type| accepts multi-values. | 134 // Returns |true| if |type| accepts multi-values. |
132 static bool SupportsMultiValue(ServerFieldType type); | 135 static bool SupportsMultiValue(ServerFieldType type); |
133 | 136 |
134 // Creates a differentiating label for each of the |profiles|. | 137 // Creates a differentiating label for each of the |profiles|. |
135 // Labels consist of the minimal differentiating combination of: | 138 // Labels consist of the minimal differentiating combination of: |
136 // 1. Full name. | 139 // 1. Full name. |
137 // 2. Address. | 140 // 2. Address. |
138 // 3. E-mail. | 141 // 3. E-mail. |
139 // 4. Phone. | 142 // 4. Phone. |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
218 size_t num_fields_to_include, | 221 size_t num_fields_to_include, |
219 const std::string& app_locale, | 222 const std::string& app_locale, |
220 std::vector<base::string16>* labels); | 223 std::vector<base::string16>* labels); |
221 | 224 |
222 // Utilities for listing and lookup of the data members that constitute | 225 // Utilities for listing and lookup of the data members that constitute |
223 // user-visible profile information. | 226 // user-visible profile information. |
224 FormGroupList FormGroups() const; | 227 FormGroupList FormGroups() const; |
225 const FormGroup* FormGroupForType(const AutofillType& type) const; | 228 const FormGroup* FormGroupForType(const AutofillType& type) const; |
226 FormGroup* MutableFormGroupForType(const AutofillType& type); | 229 FormGroup* MutableFormGroupForType(const AutofillType& type); |
227 | 230 |
228 // Appends unique names from |names| onto the |name_| list, dropping | 231 // If a name in |names| has the same full name representation |
229 // duplicates. If a name in |names| has the same full name representation | 232 // as a name in |name_|, keeps the one that has more information (i.e. |
230 // as a name in |name_|, keeps the variant that has more information (i.e. | |
231 // is not reconstructible via a heuristic parse of the full name string). | 233 // is not reconstructible via a heuristic parse of the full name string). |
232 void OverwriteOrAppendNames(const std::vector<NameInfo>& names, | 234 void OverwriteName(const NameInfo& names, const std::string& app_locale); |
please use gerrit instead
2015/06/04 23:24:28
s/names/name
Other places in the code usually use
Evan Stade
2015/06/05 00:39:08
Done.
| |
233 const std::string& app_locale); | |
234 | 235 |
235 // Same as operator==, but ignores differences in GUID. | 236 // Same as operator==, but ignores differences in GUID. |
236 bool EqualsSansGuid(const AutofillProfile& profile) const; | 237 bool EqualsSansGuid(const AutofillProfile& profile) const; |
237 | 238 |
238 RecordType record_type_; | 239 RecordType record_type_; |
239 | 240 |
240 // Personal information for this profile. | 241 // Personal information for this profile. |
241 std::vector<NameInfo> name_; | 242 NameInfo name_; |
242 std::vector<EmailInfo> email_; | 243 std::vector<EmailInfo> email_; |
243 CompanyInfo company_; | 244 CompanyInfo company_; |
244 std::vector<PhoneNumber> phone_number_; | 245 std::vector<PhoneNumber> phone_number_; |
245 Address address_; | 246 Address address_; |
246 | 247 |
247 // The BCP 47 language code that can be used to format |address_| for display. | 248 // The BCP 47 language code that can be used to format |address_| for display. |
248 std::string language_code_; | 249 std::string language_code_; |
249 | 250 |
250 // ID used for identifying this profile. Only set for SERVER_PROFILEs. This is | 251 // ID used for identifying this profile. Only set for SERVER_PROFILEs. This is |
251 // a hash of the contents. | 252 // a hash of the contents. |
252 std::string server_id_; | 253 std::string server_id_; |
253 }; | 254 }; |
254 | 255 |
255 // So we can compare AutofillProfiles with EXPECT_EQ(). | 256 // So we can compare AutofillProfiles with EXPECT_EQ(). |
256 std::ostream& operator<<(std::ostream& os, const AutofillProfile& profile); | 257 std::ostream& operator<<(std::ostream& os, const AutofillProfile& profile); |
257 | 258 |
258 } // namespace autofill | 259 } // namespace autofill |
259 | 260 |
260 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_PROFILE_H_ | 261 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_PROFILE_H_ |
OLD | NEW |