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 24 matching lines...) Expand all Loading... | |
35 // A profile synced down from the server. These are read-only locally. | 35 // A profile synced down from the server. These are read-only locally. |
36 SERVER_PROFILE, | 36 SERVER_PROFILE, |
37 | 37 |
38 // An auxiliary profile, such as a Mac address book entry. | 38 // An auxiliary profile, such as a Mac address book entry. |
39 AUXILIARY_PROFILE, | 39 AUXILIARY_PROFILE, |
40 }; | 40 }; |
41 | 41 |
42 AutofillProfile(const std::string& guid, const std::string& origin); | 42 AutofillProfile(const std::string& guid, const std::string& origin); |
43 | 43 |
44 // Server profile constructor. The type must be SERVER_PROFILE (this serves | 44 // Server profile constructor. The type must be SERVER_PROFILE (this serves |
45 // to differentiate this constructor). | 45 // to differentiate this constructor). |server_id| can be empty. If empty, |
46 // callers should invoke GenerateServerProfileIdentifier after setting data. | |
46 AutofillProfile(RecordType type, const std::string& server_id); | 47 AutofillProfile(RecordType type, const std::string& server_id); |
47 | 48 |
48 // For use in STL containers. | 49 // For use in STL containers. |
49 AutofillProfile(); | 50 AutofillProfile(); |
50 AutofillProfile(const AutofillProfile& profile); | 51 AutofillProfile(const AutofillProfile& profile); |
51 ~AutofillProfile() override; | 52 ~AutofillProfile() override; |
52 | 53 |
53 AutofillProfile& operator=(const AutofillProfile& profile); | 54 AutofillProfile& operator=(const AutofillProfile& profile); |
54 | 55 |
55 // FormGroup: | 56 // FormGroup: |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
174 std::vector<base::string16>* labels); | 175 std::vector<base::string16>* labels); |
175 | 176 |
176 const std::string& language_code() const { return language_code_; } | 177 const std::string& language_code() const { return language_code_; } |
177 void set_language_code(const std::string& language_code) { | 178 void set_language_code(const std::string& language_code) { |
178 language_code_ = language_code; | 179 language_code_ = language_code; |
179 } | 180 } |
180 | 181 |
181 // Nonempty only when type() == SERVER_PROFILE. | 182 // Nonempty only when type() == SERVER_PROFILE. |
182 const std::string& server_id() const { return server_id_; } | 183 const std::string& server_id() const { return server_id_; } |
183 | 184 |
185 // FIXME documentation | |
brettw
2015/04/07 18:04:06
finish this.
Evan Stade
2015/04/07 19:23:32
Done.
| |
186 void GenerateServerProfileIdentifier(); | |
187 | |
184 // Returns a standardized representation of the given string for comparison | 188 // Returns a standardized representation of the given string for comparison |
185 // purposes. The resulting string will be lower-cased with all punctuation | 189 // purposes. The resulting string will be lower-cased with all punctuation |
186 // substituted by spaces. Whitespace will be converted to ASCII space, and | 190 // substituted by spaces. Whitespace will be converted to ASCII space, and |
187 // multiple whitespace characters will be collapsed. | 191 // multiple whitespace characters will be collapsed. |
188 // | 192 // |
189 // This string is designed for comparison purposes only and isn't suitable | 193 // This string is designed for comparison purposes only and isn't suitable |
190 // for storing or displaying to the user. | 194 // for storing or displaying to the user. |
191 static base::string16 CanonicalizeProfileString(const base::string16& str); | 195 static base::string16 CanonicalizeProfileString(const base::string16& str); |
192 | 196 |
193 // Returns true if the given two profile strings are similar enough that | 197 // Returns true if the given two profile strings are similar enough that |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
250 // Personal information for this profile. | 254 // Personal information for this profile. |
251 std::vector<NameInfo> name_; | 255 std::vector<NameInfo> name_; |
252 std::vector<EmailInfo> email_; | 256 std::vector<EmailInfo> email_; |
253 CompanyInfo company_; | 257 CompanyInfo company_; |
254 std::vector<PhoneNumber> phone_number_; | 258 std::vector<PhoneNumber> phone_number_; |
255 Address address_; | 259 Address address_; |
256 | 260 |
257 // The BCP 47 language code that can be used to format |address_| for display. | 261 // The BCP 47 language code that can be used to format |address_| for display. |
258 std::string language_code_; | 262 std::string language_code_; |
259 | 263 |
260 // ID assigned by the server. This will be set only for WALLET_PROFILEs. | 264 // ID used for identifying this profile. Only set for SERVER_PROFILEs. This is |
265 // a hash of the contents. | |
261 std::string server_id_; | 266 std::string server_id_; |
262 }; | 267 }; |
263 | 268 |
264 // So we can compare AutofillProfiles with EXPECT_EQ(). | 269 // So we can compare AutofillProfiles with EXPECT_EQ(). |
265 std::ostream& operator<<(std::ostream& os, const AutofillProfile& profile); | 270 std::ostream& operator<<(std::ostream& os, const AutofillProfile& profile); |
266 | 271 |
267 } // namespace autofill | 272 } // namespace autofill |
268 | 273 |
269 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_PROFILE_H_ | 274 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_PROFILE_H_ |
OLD | NEW |