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

Side by Side Diff: chrome/browser/autofill/autofill_profile.h

Issue 6877130: These changes *are* for review :) (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 7 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_AUTOFILL_AUTOFILL_PROFILE_H_ 5 #ifndef CHROME_BROWSER_AUTOFILL_AUTOFILL_PROFILE_H_
6 #define CHROME_BROWSER_AUTOFILL_AUTOFILL_PROFILE_H_ 6 #define CHROME_BROWSER_AUTOFILL_AUTOFILL_PROFILE_H_
7 #pragma once 7 #pragma once
8 8
9 #include <stddef.h> 9 #include <stddef.h>
10 #include <list> 10 #include <list>
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 // Equality operators compare GUIDs and the contents in the comparison. 112 // Equality operators compare GUIDs and the contents in the comparison.
113 // TODO(dhollowa): This needs to be made multi-profile once Sync updates. 113 // TODO(dhollowa): This needs to be made multi-profile once Sync updates.
114 bool operator==(const AutofillProfile& profile) const; 114 bool operator==(const AutofillProfile& profile) const;
115 virtual bool operator!=(const AutofillProfile& profile) const; 115 virtual bool operator!=(const AutofillProfile& profile) const;
116 116
117 // Returns concatenation of full name and address line 1. This acts as the 117 // Returns concatenation of full name and address line 1. This acts as the
118 // basis of comparison for new values that are submitted through forms to 118 // basis of comparison for new values that are submitted through forms to
119 // aid with correct aggregation of new data. 119 // aid with correct aggregation of new data.
120 const string16 PrimaryValue() const; 120 const string16 PrimaryValue() const;
121 121
122 // Normalizes the home phone and fax numbers.
123 // Should be called after all of the form data is imported into profile.
124 // If PHONE_*_WHOLE_NUMBER is not set, then derives it from PHONE_*_CITY_CODE,
125 // PHONE_*_COUNTRY_CODE and PHONE_*_CITY_AND_NUMBER.
126 // Drops unparsable numbers, so the numbers that are incomplete or wrong
127 // are not saved. Returns true if all numbers were successfully parsed,
128 // false otherwise.
129 bool NormalizePhones();
130
122 // Overwrites the single-valued field data in |profile| with this 131 // Overwrites the single-valued field data in |profile| with this
123 // Profile. Or, for multi-valued fields append the new values. 132 // Profile. Or, for multi-valued fields append the new values.
124 void OverwriteWithOrAddTo(const AutofillProfile& profile); 133 void OverwriteWithOrAddTo(const AutofillProfile& profile);
125 134
126 private: 135 private:
127 typedef std::vector<const FormGroup*> FormGroupList; 136 typedef std::vector<const FormGroup*> FormGroupList;
128 137
138 // Checks if the |phone| is in the |existing_phones| using fuzzy matching:
139 // for example, "1-800-FLOWERS", "18003569377", "(800)356-9377" and "356-9377"
140 // are considered the same.
141 // Adds the |phone| to the |existing_phones| if not already there.
142 void AddPhoneIfUnique(const string16& phone,
143 std::vector<string16>* existing_phones);
144
129 // Builds inferred label from the first |num_fields_to_include| non-empty 145 // Builds inferred label from the first |num_fields_to_include| non-empty
130 // fields in |label_fields|. Uses as many fields as possible if there are not 146 // fields in |label_fields|. Uses as many fields as possible if there are not
131 // enough non-empty fields. 147 // enough non-empty fields.
132 string16 ConstructInferredLabel( 148 string16 ConstructInferredLabel(
133 const std::vector<AutofillFieldType>& label_fields, 149 const std::vector<AutofillFieldType>& label_fields,
134 size_t num_fields_to_include) const; 150 size_t num_fields_to_include) const;
135 151
136 // Creates inferred labels for |profiles| at indices corresponding to 152 // Creates inferred labels for |profiles| at indices corresponding to
137 // |indices|, and stores the results to the corresponding elements of 153 // |indices|, and stores the results to the corresponding elements of
138 // |created_labels|. These labels include enough fields to differentiate among 154 // |created_labels|. These labels include enough fields to differentiate among
(...skipping 15 matching lines...) Expand all
154 // The label presented to the user when selecting a profile. 170 // The label presented to the user when selecting a profile.
155 string16 label_; 171 string16 label_;
156 172
157 // The guid of this profile. 173 // The guid of this profile.
158 std::string guid_; 174 std::string guid_;
159 175
160 // Personal information for this profile. 176 // Personal information for this profile.
161 std::vector<NameInfo> name_; 177 std::vector<NameInfo> name_;
162 std::vector<EmailInfo> email_; 178 std::vector<EmailInfo> email_;
163 CompanyInfo company_; 179 CompanyInfo company_;
164 std::vector<HomePhoneNumber> home_number_; 180 std::vector<PhoneNumber> home_number_;
165 std::vector<FaxNumber> fax_number_; 181 std::vector<PhoneNumber> fax_number_;
166 Address address_; 182 Address address_;
167 }; 183 };
168 184
169 // So we can compare AutofillProfiles with EXPECT_EQ(). 185 // So we can compare AutofillProfiles with EXPECT_EQ().
170 std::ostream& operator<<(std::ostream& os, const AutofillProfile& profile); 186 std::ostream& operator<<(std::ostream& os, const AutofillProfile& profile);
171 187
172 #endif // CHROME_BROWSER_AUTOFILL_AUTOFILL_PROFILE_H_ 188 #endif // CHROME_BROWSER_AUTOFILL_AUTOFILL_PROFILE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698